Concatenate Strings

I'd like to understand how to concatenate strings (non numeric data) in KM. Do I use a + or an &, please clarify

Nope, you do NOT use any operators like in most languages. Just place the KM Variable Tokens (and any other text) next to each other like this:


1 Like

See the Text Fields wiki page for more details.

Is the underscore character used as a separator between text strings or text variables?

No. The underscore, as I used it above, is just another character in the Variable name.
However, if you use two underscores in a KM Variable name, then when you use that Variable in a Prompt for User Input, only the characters to the right of the two underscores is displayed.

So, for example, the Variable

would be displayed as

For more information, see the KM Wiki on Variables .

So let's say you had 3 string variables you wanted to concatenate which had names substring1, substring2 and substring3. How would you put them together?

Just as shown above:

For your use case:

My 3 variables are now AreaCode, Exchange and Number

They are each defined by the substring function that extracts the first 3 digits of raw phone number, the 4-6 digits and the last 4 digits respectively.

I'm now attempting to define variable called FinalPhone using your format and adding dashes where needed but it is not working correctly.

Seems that %Variable%AreaCode%-%Variable%Exchange%-%Variable%Number%

should work. Where am I going wrong?

I tried adding additional % characters before and after the dashes but this did not work either. Generated an error message

That works for me. There must be some other error in your macro.
Please upload your macro .