Navigation: thinBasic Modules > Core > String handling > STR$ |
|
Description
Return the string representation of a number in printable form.
Syntax
s = STR$(NumericExpression [, Digits])
Returns
String
Parameters
Name |
Type |
Optional |
Meaning |
NumericExpression |
Numeric |
No |
Any numeric expression to be transformed to string |
Digits |
Numeric |
Yes |
Specifies the maximum number of significant digits (1 to 18) desired in the result. |
Remarks
If NumericExpression is greater than or equal to zero, STR$ adds a leading space character; if NumericExpression is less than zero, STR$ adds a leading negation (minus) character.
Restrictions
See also
Examples
Thanks to Abraxas for the following script example
' Usage of the STR$ Keyword example
Dim numeric_expression As EXT VALUE 123.4567890123456
Dim digits As DWORD
Dim sMsg As String
sMsg += "Different STR$(numeric_expression, digits) of " & numeric_expression & $CRLF
sMsg += "Digits will be from 1 to 18" & $CRLF & $CRLF
For digits = 1 To 18
sMsg += "Digit = " & digits & " Result: " & STR$(numeric_expression, digits) & $CRLF
Next
MSGBOX 0, sMsg
© 2004-2008 thinBasic. All rights reserved. | Version 1.7.0.0 | Web Site: http://www.thinbasic.com |