Concatenates its two operands, after interpreting them as strings.
The string Concatenate operator (_) is a binary (two-operand) operator that interprets its operands as strings and returns a string value.
You use Concatenate to combine string literals, numbers, expressions, and variables. It takes the form:
Concatenate produces a result that is a string composed of the right operand appended to the left operand. Concatenate gives its operands no special interpretation. It treats them as string values.
The following example concatenates two strings:
When concatenating a numeric literal to another numeric literal or to a non-numeric string, InterSystems IRIS first converts each of the numbers to canonical form. The following example concatenates two numeric literals:
The following example concatenates a numeric literal and a numeric string:
returns the string 7+007.
The following example concatenates two strings and the null string:
The null string has no effect on the length of a string. You can concatenate an infinite number of null strings to a string.
There is a maximum limit to the length of a string; see String Length Limit. Attempting to concatenate strings that would result in a string exceeding this maximum string size results in a <MAXSTRING> error.
An ObjectScript statement involving multiple concatenations is an atomic (all-or-nothing) operation. In the event of a <MAXSTRING> error, the variable being enlarged by concatenation retains its value prior to the concatenation. For example, if bigstr is a string of length 2,000,000, attempting the concatenation SET bigstr=bigstr_"abc"_bigstr would result in a <MAXSTRING> error. The length of bigstr remains 2,000,000.