标签:
package edu.xl.lesson1;
/**
* 检索字符串分组并求长度
* @author Administrator
*
*/
public class Test {
public static void main(String[] args) {
String str="djdkf我2323232你们ddjdk";
//英文
int char1=0;
//数字
int char2=0;
//汉字
int char3=0;
for(int i=0;i<str.length();i++){
int c=str.charAt(i);
if(c>=‘A‘&& c<=‘z‘){
char1++;
}else if(c>=48 && c<=57){
char2++;
}else{
char3++;
}
}
System.out.println(char1+","+char2+","+char3);
}
}
标签:
原文地址:http://www.cnblogs.com/ADAD/p/4793355.html