floating point - Equivalent of %g in java.text.DecimalFormat? -
i'm using freemarker uses java.text.decimalformat
numeric formatting. i'm used sprintf()
-style formatting, , lot of times use %g
chooses shorter of %f
or %e
formatting.
is there way equivalent using java.text.decimalformat
?
the straight-up answer question not. not without formatting in both formats , comparing length hand , outputting 1 better.
is there possibility use java.util.formatter
instead? %g
, sprintf()
formats.
Comments
Post a Comment