是的,replaceAll
方法支持链式调用。可以连续调用多个 replaceAll
方法来对字符串进行多次替换操作。例如:
String str = "Hello world!";
String newStr = str.replaceAll("Hello", "Hi").replaceAll("world", "Universe");
System.out.println(newStr); // Output: Hi Universe!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>