public static void main(String[] args) {
String s = "a";
s = s.replaceAll(".", "\\");
}
以上程序报错如下:
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
请问是什么原因?谢谢!
...全文
4016打赏收藏
String.replaceAll(".", "\\")的报错问题
public static void main(String[] args) { String s = "a"; s = s.replaceAll(".", "\\"); } 以上程序报错如下: java.lang.StringIndexOutOfBoundsException: String index out of range: 1 请问是什么原因?谢谢!