/**
*统计大小写字母、字符数
*/
public class TestString
{
public static void main (String[] args)
{
String s = "fadfhaSKJSHK*&^%GUgiugiu";
int lCount = 0,uCount = 0,oCount = 0;
for(int i= 0;i<s.length();i++)
{
char c = s.charAt(i);
if(c>='a'&&c<='z')
{
lCount++;
}
else if(c>='A'&&c<='Z')
{
uCount++;
}
else
{
oCount++;
}
}
System.out.println(lCount+" "+uCount+" "+oCount);
}
}
/**
*找子串个数
*/
public class TestString
{
public static void main (String[] args)
{
String s = "abcjkgabclouabckgfabctujabc";
String sToFind = "abc";
int count = 0;
int index = -1;
while((index = s.indexOf(sToFind))!= -1)
{
s = s.substring(index + sToFind.length());
count ++;
}
System.out.println(count);
}
}