您的位置:首页 > 编程语言 > Java开发

java--charAt()

2017-10-16 20:07 218 查看
public class TestString{
public static void main(String[] args)
{
int lowCount=0,hCount=0,oCount=0;
String S="alhjfweoihfHIFGIUE154355644164";
for(int i=0;i<S.length();i++)
{
char c=S.charAt(i);
if(c>='a'&&c<='z')
{
lowCount++;
}else if(c
7534
>='A'&&c<='Z')
{
hCount++;
}else
{
oCount++;
}
}

System.out.println(lowCount+" "+hCount+" "+oCount);
}

}


charAt(index) 返回指定索引处index的 char 值
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  string class java charAt