+(int)everyStringCount:(NSString *)str
{
for(int i = 0;i<str.length;i++)
unichar c = [str characterAtIndex:i];
int count = 1;
for(int j = i;i<str.length;j++)
{
unichar b = [str characterAtIndex:i];
if(b == c)
{
count ++;
}
NSLog(@"%c出现了%ld次!",c,count);
}
这样写对吗?
|
|