I want to find any word or full stop from a nsstring.
NSString *str = @"Hi, my name is Tina. I want to ask something. I am trying a lot. But I am not able. To find full stop. Position Everytime. It come in str.";
In this I want to track the position of full stop not first full stop positions every full stop position in "Str".
I know how to find words but not able to get full stop position every time it come on my str.
Here is what am I doing
NSString *str = @"Hi, my name is Tina. I want to ask something. I am trying a lot. But I am not able. To find full stop. Position Everytime. It come in str.";
NSInteger count = 0;
NSArray *arr = [str componentsSeparatedByString:@" "];
for(int i=0;i<[arr count];i++)
{
if([[arr objectAtIndex:i] isEqualToString:@"."])
count++;
}
I don't want this as it give me str character length not by word. I want to check after how many words full stop is comming.
if ([str3 rangeOfString:@"."].location == xOut) { // dont want
or
if ([str3 rangeOfString:@"."].location != NSNotFound) { // dont want
Any Idea or suggestion would be highly welcome.