THE BEST NEWSLETTER ANYWHERE
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.
This tutorials explains about how to concatenate Strings in Nim language.
There are multiple ways, we do string append in NIM language.
using & operator
& operator appends one string into end of another string.
var str = "one "
var str1 = "two "
var result= str & str1
echo result
strutils
module has join procedure that joins the openarray of elements to appendSyntax:
func join(a: openArray[string]; sep: string = ""): string {.....}
Input: array of strings sep - is an separator that appends between each string
Here is an example
import strutils;
var result=join(["one", "two", "three"], " ")
echo result
Output:
one two three
🧮 Tags
Recent posts
Julia examples - Variable Type Nim example - Convert String to/from the Int How to get length of an array and sequence in Nim? Nim environment variables - read, set, delete, exists, and iterate examples? How to convert from single character to/from string in Nim?Related posts