XSSI Library

Concatenation: Putting Strings Together
Developed by Bob Lathe

Regarding concatenation, it works like a charm. Turns out that the XSSI mod sees "$" as a break character, like a blank in some ways.

Thus, if you have two vars Var1 and Var2 then you can put them together as

"$Var1 $Var2" == "string1 string2" The included blank creates a string with two words.

Or you can use them as

"$Var1$Var2" == "string1string2" No blank creates a string of only one word. This form is useful for dynamically creating var values.

What does not work is trying to concatenate with a string literal, like "$Var1MoreInfoVar2" == "Var3" since the parser tries to find a var named $Var1MoreInfo. Thus, if you have a string literal, you have to first set it into a var, then do the concatenation... <!--#set var="More" value="MoreInfo" --> ... <!--#set var="Var3" value="$Var1$More$Var2" -->. This way it works fine.

Bob

<!--#set var="FirstString" value="foo" -->
<!--#set var="SecondString" value="bar" -->
<!--#set var="ThirdString" value="baz" -->
<!--#set var="Result" value="$FirstString$SecondString$ThirdString" -->
<!--#echo var="Result" -->
   

A printer-friendly version of this article is available.
This site hand-coded for your protection.