This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

String format
#1
Hello. Help format the string result. There is a value of 2.24000000001 how to limit the display of only two symbols after a point so that the result would be 2.24?
Reply
#2
Which visu?
------------------------------
Ctrl+F5
Reply
#3
Use this (.2 specifies the number of decimals):
Code:
value_num = 12.3456
value_str = string.format('%0.2f', value_num)
Reply
#4
(29.11.2021, 08:32)admin Wrote: Use this (.2 specifies the number of decimals):
Code:
value_num = 12.3456
value_str = string.format('%0.2f', value_num)
Thanks
Reply


Forum Jump: