STR$: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "The '''STR$''' function returns the STRING representation of a numerical value. {{PageSyntax}} :: result$ = '''STR$('''{{Parameter|number}}''')''' {{Parameters}} * {{Parameter|number}} is any numerical type value to convert. {{PageDescription}} * Returns any type number value with leading sign(space/minus) or decimal point when one exists in the numerical value. * If {{Parameter|number}} is positive, the STRING value returned will have a leading space chara...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
{{PageSyntax}} | {{PageSyntax}} | ||
: result$ = '''STR$('''{{Parameter|number}}''')''' | |||
{{ | {{PageParameters}} | ||
* {{Parameter|number}} is any numerical type value to convert. | * {{Parameter|number}} is any numerical type value to convert. | ||
Line 38: | Line 38: | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[VAL]], [[ | * [[VAL]], [[_TOSTR$]] | ||
* [[LTRIM$]], [[MID$]] | * [[LTRIM$]], [[MID$ (function)]] | ||
* [[ | * [[_BIN$]], [[HEX$]], [[OCT$]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 20:44, 14 November 2024
The STR$ function returns the STRING representation of a numerical value.
Syntax
- result$ = STR$(number)
Parameters
- number is any numerical type value to convert.
Description
- Returns any type number value with leading sign(space/minus) or decimal point when one exists in the numerical value.
- If number is positive, the STRING value returned will have a leading space character which can be removed using LTRIM$.
- If number is negative, the minus sign will precede the number instead of a space which LTRIM$ will not remove.
- Trimming a STR$ string number using RTRIM$ is not required as PRINT creates the undocumented trailing number space.
Examples
PRINT STR$( 1.0 ) PRINT STR$( 2.3 ) PRINT STR$( -4.5 ) |
1 2.3 -4.5 |
a = 33 PRINT STR$(a) + "10" + "1" + "who" + STR$(a) + STR$(a) + LTRIM$(STR$(a)) |
33101who 33 3333 |
See also