字符串替换

字符串替换

public class StringReplaceEmp {//字符串替换

public static void main(String[] args) {

String str = "Hello World";

System.out.println( str.replace('H', 'W'));

System.out.println( str.replace("He", "Wa"));

System.out.println( str.replaceAll("He", "Ha"));

}

}

 

posted @ 2021-10-05 21:30  慢漫曼蔓  阅读(26)  评论(0)    收藏  举报