I have a small problem parsing a string in NSScanner. I've read other SO posts on this, but cannot solve this dumb issue.
I have a string like this "the first word is not = to the second word"
My code is:
NSString *seperator = @" =";
NSCharacterSet *newLineCharacterSet = [NSCharacterSet newlineCharacterSet];
[scanner scanUpToString:seperator intoString:&firstString];
[scanner scanString:seperator intoString:NULL];
scanPosition = [scanner scanLocation];
//scanPosition = scanPosition +2;
secondString = [[scanner string] substringFromIndex:scanPosition];
[scanner scanUpToCharactersFromSet:newLineCharacterSet intoString:&secondString];
NSLog(@"firstString: %@", firstString);
NSLog(@"secondString: %@", secondString);
The problem is that I'm getting the separator as part of the secondString.
firstString: "the first word is not"
secondString is "= to the second word"