LOTUSSCRIPT LANGUAGE


String concatenation operators
Concatenate two expressions as strings.

Ampersand (&) operator

Syntax

expr1 & expr2

Elements

expr1, expr2

Return value

The result is a String or a Variant of type String, if either of the operands is a Variant.

Usage

Use the ampersand (&) operator to ensure a concatenation operation. The plus (+) operator also concatenates two character strings, but LotusScript determines whether to interpret the plus as a concatenation operator or an addition operator on the basis of the operands in the expression in which it appears.

Examples

Dim x As Variant
x = 56 & " Baker St."
Print x                         ' Prints "56 Baker St."

anInt% = 123
aString$ = "Hello"
anotherString$ = "world"
varV = NULL
Print aString$ & ", " & anInt% & " " & varV & _
   anotherString$ & "."
' Output: Hello, 123 world.

Plus (+) operator

Syntax

expr1 + expr2

Elements

expr1, expr2

Return value

The result is a String or a Variant of type String, if either of the operands is a Variant.

Usage

Use the ampersand (&) operator to ensure a concatenation operation. The plus (+) operator concatenates two character strings, but LotusScript determines whether to interpret the plus as a concatenation operator or an addition operator on the basis of the operands in the expression in which it appears.

For example:

Print 100 & "200"

' Output is 100200, because & is always
' a concatenation operator

while

Print 100 + "200"

' Output is 300, because + was interpreted
' as addition operator

Print "100" + "200"

' Output is 100200, because + was interpreted
' as concatenation operator

See Also