字符串替换

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") );

posted on 2019-09-19 22:42  每天在路上2018  阅读(189)  评论(0编辑  收藏  举报