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

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 concatenation in VBA and VFP

Visual Basic for Applications and Visual FoxPro operators to concatenate text.

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