7.13 字符串替换
- replaceAll,replaceFirst
String str = "helloworld";
System.out.println(str.replaceAll("l","_"));// 全替换
System.out.println(str.replaceFirst("l","_"));// 仅仅替换首个
相信坚持的力量,日复一日的习惯.
String str = "helloworld";
System.out.println(str.replaceAll("l","_"));// 全替换
System.out.println(str.replaceFirst("l","_"));// 仅仅替换首个