convert to string

Blitz3D Forums/Blitz3D Programming/convert to string

Rook Zimbabwe(Posted 2004) [#1]
How do I take a number and convert it into a string value.

I plan to use sprites to display my score value. I know I can use Left(string$,length) to look at it. and thus do a select to figure out what sprite to put where...

The thing I don't see it how to convery a number to a string...

-RZ


jondecker76(Posted 2004) [#2]
number# = 3.14
stringNumber$ = number
print stringNumber



MSW(Posted 2004) [#3]
erm...Directly from the Blitz command refrence:

Str variable/value
Parameters
variable/value = numeric value or variable  

Description
Use this command to transform an numeric value to a string value for use with string commands. Blitz prints numeric values just fine, but should you want to do functions like LEFT$, you'll need to convert your numeric variable to a string variable. Note: during the conversion, all 6 decimal places will be represented on floating point number conversions. 

If you wish to convert from a string to a number, there is no equivalent Val command. Instead, simply assign the string variable into a numeric variable, and Blitz will implicitly convert it.  

Example
; STR example 

num#=2.5 
mynum$=str num# 

Print mynum$  




Rook Zimbabwe(Posted 2004) [#4]
Missed that me!