CitectVBA Programming Reference > CitectVBA Function Reference > Conversion Functions > Str

Str

Converts a numeric value to a text string containing numeric characters. The Str function expects the argument Num to be a valid numeric value.

The Str function is often used to prepare a numerical value for display as a string in a caption, label, string field, or string expression.

The Str function performs the opposite of the Val function, which converts a text string containing numeric characters to a numeric value.

Note: Please remember the data type coercion considerations with variant data types. See Variants.

Syntax

Str(Num)

Num:

An Integer or expression representing a valid numeric value.

Return Value

Returns a string containing the numeric character representation of the numeric Num value provided in the argument.

The Str function reserves the first return string character for the sign of Num. If Num is positive, a leading space is used and the plus sign is implied.

Related Functions

Format | Hex |Oct | Val

Example

Dim vntVar		 ' declare result holder variable

vntVar = Str() ' returns " "
vntVar = Str(65) ' returns " 65"
vntVar = Str(97.578) ' returns " 97.578"
vntVar = Str(-97.578) ' returns "-97.578"