1. 程式人生 > >String的replace方法

String的replace方法

int string post 返回值 AI replace div ati rep

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

String的replace方法