Notifications
Clear all
Topic starter
11/02/2022 3:44 pm
Hi,
A pretty newb question I guess.
Have done some simple Ncal script previously, but have recently switched to Java.
How do I format a variable to a certain number of decimals without using the "Result format:"?
DecimalFormat and String.Format does not seem to be an option?
var Time_Sec = $prop('GarySwallowDataPlugin.Leaderboard.Position01.BestLap');
var Time_Min;
var Laptime;
//Format df = new DecimalFormat("0.00");
//DecimalFormat df = new DecimalFormat("#.###");
if (Time_Sec >= 60)
{
Time_Min="01";
Time_Sec=Time_Sec-60;
//format(Time_Sec,"%3f");
Laptime = Time_Min + ":"+ (Time_Sec);
}
else if (Time_Sec >= 120)
{
Time_Min="02";
Time_Sec=Time_Sec-120;
Laptime = Time_Min + ":"+ (Time_Sec);
}
return Time_Sec;
Montesky reacted