阅读量:143
是的,replaceAll 方法支持链式调用。可以连续调用多个 replaceAll 方法来对字符串进行多次替换操作。例如:
String str = "Hello world!";
String newStr = str.replaceAll("Hello", "Hi").replaceAll("world", "Universe");
System.out.println(newStr); // Output: Hi Universe!