Visual Basic and Visual FoxPro functions for type conversion

VBA

Str(), Val(), CDate() etc

VFP

Str(), Val(), CTOD(), DTOC()

Common Syntax Notes

Both languages have Str() and Val() functions to covert between text and numbers. The FoxPro Str() functions accepts extra parameters to set the length of the string and the number of decimal places.

Both languages also have Chr() and Asc() functions for converting between characters and ASCII codes.

Visual Basic Syntax Notes

The CDate() function converts character values to dates and there are a wide range of other conversion functions with names such as CInt(), CDbl() and CLng() for converting to Integers, Double or Long data types.

Visual FoxPro Syntax Notes

FoxPro being a weakly-typed language where every variable is essentially the same as a Visual Basic variant has fewer of these type conversion functions than VBA. Most of them are used to convert between text, date and time values. For example: DtoC() converts date to character and CtoT() converts character to time.

Formatting text  |  Text functions  |  Delimiters