我正在try 使用字符串的.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));
}
}
由此我了解到%
字符是被禁止的.如果是这样,那么我应该使用什么作为参数占位符?
我用的是Scala 2.8.