Skip to main content

Concatenating Strings

Concatenating Strings

You can concatenate two strings into a single string using the concatenate operator:

 SET a = "Inter"
 SET b = "Systems"
 SET string = a_b
 WRITE string

By using the concatenate operator you can include non-printing characters in a string. The following string includes the linefeed ($CHAR(10)) character:

 SET lf = $CHAR(10)
 SET string = "This"_lf_"is"_lf_"a string"
 WRITE string
Note:

How non-printing characters display is determined by the display device. For example, the Terminal differs from browser display of the linefeed character, and other positioning characters. In addition, different browsers display the positioning characters $CHAR(11) and $CHAR(12) differently.

InterSystems IRIS encoded strings — bit strings, List structure strings, and JSON strings — have limitations on their use of the concatenate operator. For further details, see Concatenate Encoded Strings.

Some additional considerations apply when concatenating numbers. For further details, see “Concatenating Numbers”.

FeedbackOpens in a new tab