public void testString() {
String str = "sajskgaAGHGJHkjshfda";
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length(); i++) {
if(str.substring(i, i+1).equals(str.substring(i,i+1).toLowerCase())){
sb.append(str.substring(i,i+1).toUpperCase());
}else{
sb.append(str.substring(i,i+1).toLowerCase());
}
}
System.out.println(sb);
}
网友评论