using System;
public class Demo {
public static void Main() {
string myStr;
int i, len, lower_case, upper_case;
myStr = "Hello";
Console.Write("String: "+myStr);
lower_case = 0;
upper_case = 0;
len = myStr.Length;
for(i=0; i<len; i++) {
if(myStr[i]>='a' && myStr[i]<='z') {
lower_case++;
} else if(myStr[i]>='A' && myStr[i]<='Z') {
upper_case++;
}
}
Console.Write("/nCharacters in lowecase: {0}/n", lower_case);
Console.Write("Characters in uppercase: {0}/n/n", upper_case);
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265927.html