Mixed string/MString expressions

Mstring expressions are formed using string and mstring elements along with the concatenation operator. Mstring expressions differ from string expressions in that they contain at least one mstring variable. The result of an mstring expression is an mstring.

If an expression has the form,

- MSTRING + STRING

the result is a new mstring formed by appending the given string as a new line at the end of the given MSTRING.

EASI>local string s
EASI>local mstring ms, result
EASI>s = "apples"
EASI>ms[1] = "bananas"
EASI>ms[2] = "pears"
EASI>result = ms + s
EASI>print result
bananas
pears
apples

If the expression is of the form,

 -STRING + MSTRING

the result is an mstring formed by prepending a new line containing the given string to the beginning of the given mstring.

EASI>result = s + ms
EASI>print result
apples
bananas
pears

If an expression contains a series of concatenations, they are evaluated from left to right as either string concatenations, or mstring concatenations, or mixed string/mstring concatenations depending on the types of data involved at that point in the evaluation. This may produce unexpected results if care is not taken, for example:

EASI>result = ms + s + s
EASI>print result
bananas
pears
apples
apples

but

EASI>result = s + s + ms
EASI>print result
applesapples
bananas
pears

This is because the EASI first evaluates s+s as a string concatenation, producing the result "applesapples", then the next concatenation operation results in the string "applesapples" being prepended to the given mstring. The use of brackets is useful to ensure that concatention occurs in the way intended. For example, brackets around the previous example give a different result:

EASI>result = s + ( s + ms )
EASI>print result
apples
apples
bananas
pears

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.