JAVA中:
public class Test { public static void main(String args[]) { String Str = new String("hello"); System.out.print("返回值 :" ); System.out.println(Str.replace('o', 'T')); System.out.print("返回值 :" ); System.out.println(Str.replace('l', 'D')); } } 返回值 :hellT 返回值 :heDDo
JS中:
var Str = "hello"
Str.replace('o','T'); 返回:Str = "hellT"
Str.replace('l','D'); 返回:Str = "heDDo"