字符串替换 java中的replace()

栗子

把字符串 'foothebar' 中的th替换为 ‘22’

代码实现

public  class StringReplaceEmp{

       public  static  void  main(String  args[]){

             String  str  =  "foothebar";

             System.out.println(str.replace('th','22')); 

    }

}

原文地址:https://www.cnblogs.com/simpledu/p/14327192.html