天天看点

java中,字符串中的函数的替换方法

public class TestReplace {

public static void main(String[] args) {

// TODO Auto-generated method stub

 String text = "I LIKE JAVA";

   String newText = text.replace('I', 'L');     // Modify the string text

   System.out.println(newText);

}

}

结果如下:L LLKE JAVA