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

Related Items

VFP and VBA.

The Visual FoxPro and Visual Basic for Applications languages are similar but there are annoying differences between them.

Read More

Text delimiters in VBA and VFP.

Visual Basic for Applications and Visual FoxPro delimiters for strings.

Read More

Text substrings in VBA and VFP

Visual Basic for Applications and Visual FoxPro functions to extract substrings from within a string of text

Read More

Trimming text in VBA and VFP

Visual Basic for Applications and Visual FoxPro functions to trim leading and trailing spaces from string of text

Read More

Finding characters in VBA and VFP

Visual Basic for Applications and Visual FoxPro functions to find the position of one character inside another string.

Read More