提取字符中的大小写字母:
public class UpperLowerCase {
public static void main(String []args) {
String StrA="I am Tom.I am from China.";
String StrB="";
String StrC="";
for(int i=0;i
if(Character.isUpperCase(StrA.charAt(i)))
StrB +=StrA.charAt(i)+" ";
if(Character.isLowerCase(StrA.charAt(i)))
StrC +=StrA.charAt(i)+" ";
}
System.out.println("字符串中大写字母有:"+StrB);
System.out.println("字符串中小写字母有:"+StrC);
}
}
输出结果为:
字符串中大写字母有:I T I C
字符串中小写字母有:a m o m a m f r o m h i n a
问心
问心
190***080@qq.com9个月前 (04-12)