Str, Str$ (functions)

Syntax

Str[$](number)

Description

Returns a string representation of the given number.

Comments

The number parameter is any numeric expression or expression convertible to a number. If number is negative, then the returned string will contain a leading minus sign. If number is positive, then the returned string will contain a leading space.

Singles are printed using only 7 significant digits. Doubles are printed using 15–16 significant digits.

These functions recognize the decimal separator and thousands separators as specified in the Regional Settings in the Control Panel. If the regional settings are changed, these functions will recognize it and act accordingly. The CStr, Format, and Format$ functions also determine their separators based on the regional settings.

Example

In this example, the Str$ function is used to display the value of a numeric variable.

Sub Main()
  x# = 100.22
  MsgBox "The string value is: " + Str(x#)
End Sub

See Also

Format, Format$ (functions); CStr (function).

More information

S