java三种判断字母大小写的方法
来源:互联网 发布:淘宝王子什么联系的 编辑:程序博客网 时间:2024/09/21 06:35
public class AaNum {
public static void main(String[] args)
{
String s = new String("12HMa&%$k#d_34H3aH");
int max = 0;
int min = 0;
int other = 0;
for (int i = 0;i < s.length();i++)
{
if(s.charAt(i)>='A'&&s.charAt(i)<='Z')
{
max++;
}
else if(s.charAt(i)>='a'&&s.charAt(i)<='z')
{
min++;
}
else
other++;
}
System.out.println("max:"+max+"\nmin:"+min+"\nother:"+other);
max = 0;
min = 0;
other = 0;
for (int i = 0;i < s.length();i++)
{
if(Character.isUpperCase(s.charAt(i)) == true)
{
max++;
}
else if(Character.isLowerCase(s.charAt(i)) == true)
{
min++;
}
else
other++;
}
System.out.println("max:"+max+"\nmin:"+min+"\nother:"+other);
max = 0;
min = 0;
other = 0;
String sL = "abcdefghijklmnopqrstuvwxyz";
String sU = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = 0;i < s.length();i++)
{
if(sL.indexOf(s.charAt(i)) != -1)
{
max++;
}
else if(sU.indexOf(s.charAt(i)) != -1)
{
min++;
}
else
other++;
}
System.out.println("max:"+max+"\nmin:"+min+"\nother:"+other);
}
}
- java三种判断字母大小写的方法
- Java三种判断字母大小写的方法
- java中判断字母的大小写,并互相转化的方法
- 大小写字母多少的判断
- Java 判断汉字以及大小写字母
- java中忽略字母大小写判断相等
- [java]字母大小写的转换
- java字母的大小写转换
- C#判断字母大小写
- 判断大小写字母
- 1173判断大小写字母
- java 判断字符串中 大小写字母 数字和其他字符个数方法
- java 中判断一个字符串中大小写字母的个数及其思路
- 大小写字母转换方法
- (java)华为机试题:字母大小写判断
- java 大小写字母和数字的随机数
- 华为OJ:字母大小写判断
- java 大小写字母转换
- The connection to adb is down, and a severe error has occured.
- servlet2.5过滤器简单讲解
- 黑马程序员C#接口
- ios下拉刷新笔记
- dwr 后台服务器推送技术
- java三种判断字母大小写的方法
- myeclipse集成AspectJ ajdt 插件
- 两个鸡蛋和一百层楼的问题
- 2014百度武汉站研发题
- 定长线段最多覆盖点的个数
- dataguard 中standby有大量gap解决方法
- java笔试题---interface与abstract class的区别
- ftp yum源的配置
- 计数排序