STR$ - QB64 Wiki

STR$

From QB64 Wiki

Revision as of 15:02, 14 November 2010 by Clippy (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The STR$ function returns the STRING representation of a numerical value.


Syntax:

result$ = STR$(number)


Description:

  • number is any numerical type value to convert.
  • If number is positive, the STRING value returned will have a leading space character. The leading space can be removed using LTRIM$.
  • If number is negative, the minus sign will precede the number instead of a space.
  • Returns any type number value with decimal point when needed.
  • Trimming a number using RTRIM$ is not required as STR$ removes the undocumented trailing PRINT number space.


Code 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:


Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page