label.set value...
-
hello, I am using a Label to display the values of my buttons.
I am using Label.set ("text", value);but the problem is that on percentage, the label displays 0, 0.1567382783 ...
I do not remember and I cannot find how to modify this. I would like it to display 10 11 67%
. as I have about 30 buttons, each has its value in linear, in freq, in% ....
an idea?
thank you ;) -
Math.round()
orEngine.doubleToString()
-
@yall A percentage is nothing but a ratio value x 100... But if you just multiply by 100, then you'll get all the decimals you certainly don't want.
So if you want a rounded value:Math.round(value * 100);
and if you still want decimals
Engine.doubleToString(value * 100, 1); // where 1 is the number of decimals
-