Page

D.2.3- Concatenation operators

Created by Brendan Doss.
Last Updated by Brendan Doss.  

PublicCategorized as Appendix D.

Not yet tagged
<< D.2.2- Arithmetic operatorsAppendixDD.2.4- Comparison operators >>

Concatenation operators

Concatenation operators are usedfor concatenating expressions; they are listed in order of Operator Precedence.

 

&

Name

 

Description

 

Syntax

 

 

 

Example

 

 

 

 

Note

 

Ampersand

 

Concatenates two expressions.

 

Returns the concatenated expressions:

 

Result = expression1 & expression2

 

If expression1 is "WROX " and expression2 is " Press" then the result is  "WROX Press".

 

 

The expressions are converted to a String subtype, if they
are not already of this subtype.

 

+

Name

 

Description

 

Syntax

 

 

 

Example

 

 

Note

     

 

+ Operator

 

Does the same as the & operator if both expressions are strings.

 

Returns the concatenated or summed expressions:

 

Result = expression1 + expression2

 

1 + "1" = 2

"1" + "1" = "11"

 

If one or both expressions are numeric, the + operator will work as an arithmetic + operator and sum the expressions.
A runtime error occurs if one expression is numeric and the other a string containing no numbers. It is recommended
that + should only be used for numeric addition and never for concatenation purposes (use & instead).

<< D.2.2- Arithmetic operatorsAppendixDD.2.4- Comparison operators >>

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |