converting a float to a string

BlitzMax Forums/BlitzMax Beginners Area/converting a float to a string

Bremer(Posted 2005) [#1]
How would you convert a float to a string with a fixed number after the decimal point? I have tried different things, but none of them works.


Dreamora(Posted 2005) [#2]
you would have to write an own parse function that uses string () and left ()


klepto2(Posted 2005) [#3]
You could do it that way:


Global Number:Float = 34.65783344
Global fixed:Int = 5
Global String_number:String 

String_number = String_number.FromFloat(Number)
Global Point:Int = String_number.Find(".")

String_number = String_number[..Point + fixed+1]

Print Number
Print String_number 




Bremer(Posted 2005) [#4]
@klepto2, thats exactly what I was looking for, thanks :)