复习一下
package test;
public class StringTest {
public static void main(String[] args) {
String temp;
String str="good morning";
System.out.println("原:" +str);
str=str.replace('o','w');
System.out.println("o全换成w后:" +str);
temp=str;
str="";
for(int i=0;i<temp.length();i++){
if(temp.charAt(i)!='n'){
str+=temp.charAt(i);
}
}
System.out.println("去掉所有n后:"+str);
str=str.replace("g","12345g");
System.out.println("在g前面加12345后:"+str);
System.out.println("字符串长度为:"+str.length());
str=str.toUpperCase();
System.out.println("字符串小写变为大写后:"+str);
temp=str;
str="";
for(int i=temp.length()-1;i>=0;i--){
str+=temp.charAt(i);
}
System.out.println("字符串倒序输出:" +str);
}
}