Vex: convert float to string? {[SOLVED]}

   Views 4678   Replies 2   Subscribers 1
User Avatar
Member
1114 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
User Avatar
Member
319 posts
Joined: Jan. 2013
Offline
You can use the format function for this
string f = sprintf("%.5f", 0.15979);
User Avatar
Member
1114 posts
Joined: April 2017
Offline
Oh! Much more elegant than my smelly garbage of a script!

Thanks!

-Olivier
  • Quick Links