Login  Register

String.format

Posted by Peter Haub on Nov 18, 2020; 3:53pm
URL: http://imagej.273.s1.nabble.com/String-format-tp5024199.html

Hi,
I would like to execute the macro function:

s = String.format("%04d", 13);
print(s);

but I get the error message
"java.util.IllegalFormatConversionException: d != java.lang.Double in
line 1:"
"s = String . format ( "%04d" , 13 <)> ;"

If the number is float and not integer It's working:

s = String.format("%04f", 13.0);
print(s);

Could this be a bug?

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html