我想用"字符串替换^.
String str = "hello \"there";
System.out.println(str);
String str1 = str.replaceAll("\"", "^");
System.out.println(str1);
String str2= str1.replaceAll("^", "\"");
System.out.println(str2);
Run Code Online (Sandbox Code Playgroud)
输出是:
hello "there
hello ^there
"hello ^there
Run Code Online (Sandbox Code Playgroud)
为什么我"在字符串的开头和字符串^之间得到额外的
我期待:
hello "there
Run Code Online (Sandbox Code Playgroud)