我正在尝试使用.format字符串的方法。但是如果我在字符串中放置%1,%2等,则会抛出java.util.UnknownFormatConversionException指向令人困惑的Java源代码段:
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));
}
}
据此我明白,%禁止使用char。如果是这样,那么我应该将什么用于参数占位符?
我使用Scala 2.8。
温温酱
萧十郎
POPMUISE
相关分类