STR

STR(number)

Returns the text string of a number (Variant / String).


numberThe valid expression (Long).

REMARKS
* When numbers are converted to strings, a leading space is always reserved for the sign of "number".
* If "number" is positive, the returned string contains a leading space and the plus sign is implied.
* This function recognizes only the period (.) as a valid decimal separator.
* When you need to use different decimal separators (for example, in international applications), use the CSTR function to convert an expression to a string.
* You can use the CSTR function to return an expression converted to a String data type.
* You can use the FORMAT function to return a text string of a date in a particular format.
* You can use the STRCOMP function to return the result of a string comparison.
* You can use the STRREVERSE to return a text string with the characters reversed.
* You can use the STR$ function to return a String data type instead of a Variant data type.
* The equivalent .NET function is Microsoft.VisualBasic.Conversion.Str
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print Str(459)    '= " 459"  - notice the space in front  
Debug.Print Str(8.24) '= " 8.24" - notice the space in front
Debug.Print Str(0.24) '= " .24" - notice the space in front
Debug.Print Str(10) '= " 10" - notice the space in front

Dim sResult As String
sResult = Str(100)
Debug.Print sResult

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top