public class TestString {
public static void main(String[] args) {String s="sjfief738t3SFKJEIFJfjwiefjdsjf49339.,ll;";int lcount=0,ucount=0,ocount=0;for(int i =0;i<s.length();i++){char c=s.charAt(i);if(c<='z'&&c>='a'){lcount++;}else{if(c<='Z'&&c>='A'){ucount++;}else{ocount++;}}}System.out.println(lcount+ " "+ucount+" "+ocount);}
}
在一个字符串中求出 大写字母的个数,小写字母的个数,及非英文字母数
最新推荐文章于 2023-03-07 21:58:22 发布