String foo = "a3#4#b";
String afterPunctutationRemoval = foo.replaceAll("[,.;:?!'-_\"/()\\{}]", "");
System.out.println(afterPunctutationRemoval);
当我运行这个程序时,它返回了"a##b",有人能解释一下为什么吗?
难道它不应该原样返回字符串吗?
String foo = "a3#4#b";
String afterPunctutationRemoval = foo.replaceAll("[,.;:?!'-_\"/()\\{}]", "");
System.out.println(afterPunctutationRemoval);
当我运行这个程序时,它返回了"a##b",有人能解释一下为什么吗?
难道它不应该原样返回字符串吗?
""
。.
字符应该评估为每个字符。 - m12