public static void main(String[] args) {
String s="itcast";
//字符串替換操作
System.out.println("將it替換成cn.it的結(jié)果:"+s.replace("it","cn.it"));
//去除字符串空格操作
String s1=" i t c a s t ";
System.out.println("去除字符串中兩端的空格后的結(jié)果:"+s1.trim());
System.out.println("去除字符串所空格的結(jié)果:"+s1.replace(" ",""));
}
}