I'm trying to use the .format
method of a String. But if I put% 1,% 2, etc. in the string, the java.util.UnknownFormatConversionException exception is thrown by pointing to confusing Java code:
private void checkText(String s) {
int idx;
// If there are any '%' in the given string, we got a bad format
// specifier.
if ((idx = s.indexOf('%')) != -1) {
char c = (idx > s.length() - 2 ? '%' : s.charAt(idx + 1));
throw new UnknownFormatConversionException(String.valueOf(c));
}
}
I conclude that the %
character is forbidden. If so, what should I use as arguments to be replaced?
I use Scala 2.8.