- int engishCount;
- int chineseCount;
- int digitCount;
- for(int i=0;i<str.length;i++)
- {
- charch = str.charAt(i);
- if(ch>=’0’&& ch<=’9’)
- {
- digitCount++
- }
- elseif((ch>=’a’&& ch<=’z’) || (ch>=’A’ && ch<=’Z’))
- {
- engishCount++;
- }
- else
- {
- chineseCount++;
- }
- }
- System.out.println(……………);
复制代码 |
|