public void testString(){
String str="wel2come3Souhe0";
System.out.println(str.replace("e","E"));
System.out.println(str.replace('e','E'));
System.out.println(str.replaceAll("\\d","A"));
System.out.println(str.replaceAll("3","9"));
}
结果:
wEl2comE3SouhE0
wEl2comE3SouhE0
welAcomeASouheA
wel2come9Souhe0