天天看點

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