String str="Hello World";
System.out.println( str.replace( ‘H‘,‘W‘ ) );
System.out.println( str.replaceFirst("He", "Wa") );
System.out.println( str.replaceAll("He", "Ha") );
字符串替换
原文:https://www.cnblogs.com/onetheway2018/p/11553093.html