public class Test5 {

public static void main(String[] args) {
String str = "kDLs4f0565v6K";
tod(str);
System.out.println("小写字母的个数是"+tod(str)[0]);
System.out.println("大写字母的个数是"+tod(str)[1]);
System.out.println("数字的个数是"+tod(str)[2]);
}
public static int[] tod(String str){
int[] s = new int[3];
for(int i=0;i<str.length();i++){
char ch = str.charAt(i);
if(ch>'a'&&ch<'z'){
s[0]++;
}else if(ch>'A'&&ch<'Z'){
s[1]++;
}else if(ch>'0'&&ch<'9'){
s[2]++;
}
}
return s;
}
}

相关文章:

  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
相关资源
相似解决方案