package practices;
/**
-
@Title: 找出给定字符串中大写字符(即A-Z)的个数
-
@Package: practices
-
@Description:TODO
-
@author: 陈帆
-
@date: 2019年5月30日 下午9:56:19
-
@version V1.0
*/
public class BigCase {int lower=0,upper=0,other=0;
public static void main(String[] args) {
String str = “BGgugFUOkhdsKJ12345”;
BigCase bigCase = new BigCase();
System.out.println(bigCase.CalcCapital(str));
}public int CalcCapital(String string) {
for(int i=0;i<string.length();i++) { char c = string.charAt(i); if(c<='Z'&& c>='A') { upper++; }else if(c<='z'&& c>='a') { lower++; }else { other++; } } return upper;
}
}