StringJoin
s1 <> s2 <> ...
can join a list of strings into a single string.
Attributes[StringJoin] := {Flat, OneIdentity, Protected}
Simple examples
In[1]:= "Hello" <> " " <> "World" Out[1]= "Hello World"
In[2]:= "If a=2, then " <> ToString[a^2, InputForm] <> "=" <> ToString[((a^2)) /. ((a -> 2)), InputForm] Out[2]= "If a=2, then a^2=4"
Further examples
The StringJoin
of nothing is the empty string:
In[1]:= StringJoin[] Out[1]= ""
If StringJoin
receives any non-string arguments, the expression does not evaluate:
In[2]:= "Hello" <> 5 Out[2]= "Hello" <> 5
This function takes List
arguments as well:
In[3]:= StringJoin[{"a", "b", "c"}] Out[3]= "abc"