Visual Basic and Visual FoxPro Text Concatenation

VBA

+ or &

VFP

+ or -

Visual Basic Syntax Notes

VBA allows you to mix numbers and text. If you use "&" then the result will always be text, if you use "+" then the result will be numeric if the two strings can be interpretted as being numbers:

"1" + 2 gives 3
"1" & 2 gives "12"

Visual FoxPro Syntax Notes

The "+" operator works the same in FoxPro as it does in VBA and is used for both text and numbers. The Fox "-" operator is unusual in that it removes trailing spaces before concatenating the two strings and then adds these spaces to the end of the result:

"a " - "b " gives "ab "

Delimiters  |  Text functions  |  Selecting substrings

More tips from Alvechurch Data

More tips from Alvechurch Data

There are no related items.