Hi,
some documentation on the supported formatting specifiers in Number.format(format) would be useful.
I tried using for example "%.2f" to get a two-digit-after-the-dot decimal, but that doesn't seem to be supported.
Cheers,
Matt
var f = 3.1451234;
Sys.println("%%.2f='" + f.format("%.2f") + "'");
%.2f='3.15'
%.2d='03'
%+.2d='+03'
%#.2d='03'
%0.2d='03'
%0.2d='03'
%10.2d=' 03'
% 10.2d=' 03'
%+10.2d=' +03'
% +10.2d=' +03'
%-10.2d='03 '
% -10.2d=' 03 '
%#10.2d=' 03'
%010.2d=' 03'
%010.2d=' 03'
%.2x='03'
%+.2x='03'
%#.2x='0x03'
%0.2x='03'
%0.2x='03'
%10.2x=' 03'
% 10.2x=' 03'
%+10.2x=' 03'
% +10.2x=' 03'
%-10.2x='03 '
% -10.2x='03 '
%#10.2x=' 0x03'
%010.2x=' 03'
%010.2x=' 03'
%.2u='03'
%+.2u='03'
%#.2u='03'
%0.2u='03'
%0.2u='03'
%10.2u=' 03'
% 10.2u=' 03'
%+10.2u=' 03'
% +10.2u=' 03'
%-10.2u='03 '
% -10.2u='03 '
%#10.2u=' 03'
%010.2u=' 03'
%010.2u=' 03'
%.2o='03'
%+.2o='03'
%#.2o='03'
%0.2o='03'
%0.2o='03'
%10.2o=' 03'
% 10.2o=' 03'
%+10.2o=' 03'
% +10.2o=' 03'
%-10.2o='03 '
% -10.2o='03 '
%#10.2o=' 03'
%010.2o=' 03'
%010.2o=' 03'
%.2f='3.14'
%+.2f='+3.14'
%#.2f='3.14'
%0.2f='3.14'
%0.2f='3.14'
%10.2f=' 3.14'
% 10.2f=' 3.14'
%+10.2f=' +3.14'
% +10.2f=' +3.14'
%-10.2f='3.14 '
% -10.2f=' 3.14 '
%#10.2f=' 3.14'
%010.2f='0000003.14'
%010.2f='0000003.14'
It's been a while, but since this was the first Google result for my search, this is documented now: developer.garmin.com/.../Number.html