VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />
Concatenation Operator (&)<br />
Description Forces string concatenation of two expressions.<br />
Usage result = expression1 & expression2<br />
Arguments result<br />
Any variable..<br />
expression1<br />
Any expression.<br />
expression2<br />
Any expression.<br />
Return Result will be converted to a string subtype if it is not already<br />
Remarks Whenever an expression is not a string, it is converted to a String subtype. If both<br />
expressions are Null, result is also Null. However, if only one expression is Null, that<br />
expression is treated as a zero-length string ("") when concatenated with the other<br />
expression. Any expression that is Empty is also treated as a zero-length string.<br />
Note: In addition to the & operator, you can also use the + operator <strong>for</strong> string<br />
concatenation, although use of the & operator is the preferred method.<br />
Example: Dim str1, str2, str3<br />
str1 = “AB”<br />
str2 = “CD”<br />
str3 = str1 & str2 ‘ str3 equals “ABCD”<br />
Concatenation Operator (+)<br />
Description Concatenates two strings.<br />
Usage result = expression1 + expression2<br />
Arguments result<br />
Any numeric or string variable.<br />
expression1<br />
Any valid numeric or string expression.<br />
expression2<br />
Any valid numeric or string expression.<br />
Result Either numeric or string, depending on the arguments<br />
Remarks Although you can also use the + operator to concatenate two character strings, you should use<br />
the & operator <strong>for</strong> concatenation to eliminate ambiguity and provide self-documenting code.<br />
When you use the + operator, you may not be able to determine whether addition or string<br />
concatenation will occur.<br />
The underlying subtype of the expressions determines the behavior of the + operator in the<br />
following way:<br />
If Then<br />
Both expressions are numeric Add<br />
Both expressions are strings Concatenate<br />
One expression is numeric and the<br />
other is a string Add<br />
If one or both expressions are Null expressions, result is Null. If both expressions are Empty,<br />
result is an Integer subtype. However, if only one expression is Empty, the other expression is<br />
returned unchanged as result.<br />
See also Addition Operator (+),Concatenation Operator (&), Subtraction Operator (-)<br />
Example: a = “ABC” :<br />
b = “DEF”<br />
c = a + b ‘ Variable c is now “ABCDEF”<br />
a = 1<br />
b = “1”<br />
c = a + b ‘ Variable c is now 2 (numeric value)<br />
<strong>InduSoft</strong>, Ltd. 103