contents.gifindex.gifprev1.gifnext0.gif

& Operator

Purpose

Used to force string concatenation of two operands.

Syntax

result = operand1 & operand2

Notes

Whenever an operand is a number, it is converted to a Variant of VarType 8 (String). The data type of result is String if both operands are String expressions; otherwise, result is a Variant of VarType 8 (String). If both operands are Null (VarType 1), result is also Null.

However, if only one operand is Null, that operand will be treated as a zero-length string when concatenated with the other operand. Any operand that is Empty (VarType 0) is also treated as a zero-length string.

Example

This example uses the & operator to concatenate a number (76), a string literal that contains a space, and a string variable (Var1) that contains "trombones". After concatenation, the result (NewText) contains 76 trombones.

Var1 = "trombones"

NewText = 76 & " " & Var1