Anonymous user
String concatenation: Difference between revisions
Simplified first example. Added missing "import strutils". Added example with "format".
m (→{{header|Phix}}: added syntax colouring the hard way, phix/basics) |
(Simplified first example. Added missing "import strutils". Added example with "format".) |
||
Line 1,321:
=={{header|Nim}}==
Strings can be concatenated with <code>&</code>.
<lang nim>
echo
# -> String literal.</lang>
Strings can be concatenated as arrays and joined with
<lang nim>
var str = "String"
echo
# -> String~~ literal.~~HelloWorld!</lang>
Strings can be combined using string formatting:
<lang nim>
echo "$# $# $#" % [str1, "literal.", "HelloWorld!"]▼
var str = "String"
# -> String literal. HelloWorld!</lang>▼
# Alternate form providing automatic conversion of arguments to strings.
echo "$# $# $#".format(str, 123, "HelloWorld!")
# -> String 123 HelloWorld!
=={{header|NS-HUBASIC}}==
|