Vex: convert float to string? {[SOLVED]}
6588
2
1
-
- olivierth
- Member

- 1184 posts
- Joined: April 2017
- Offline
Hi!
I've got floats like:
0.15979
0.95435
0.74896
... I need to convert those to string but I can't find a function for that. I know about the itoa() but can't find the same for floats.
...at worst I could always do it the hard way and multiply my 0.15979 by 100 000 so I cant use itoa, etc.
-Olivier
Edited by olivierth - Nov. 23, 2023 16:17:11
-
- dtempcyer
- Member

- 326 posts
- Joined: Jan. 2013
- Offline
You can use the format function for this
string f = sprintf("%.5f", 0.15979);
-
- olivierth
- Member

- 1184 posts
- Joined: April 2017
- Offline
Oh! Much more elegant than my smelly garbage of a script!
Thanks!
-Olivier