NSScanner searches from start
NSScanner searches from start
- Subject: NSScanner searches from start
- From: Ivan Myrvold <email@hidden>
- Date: Sun, 24 Jun 2001 15:39:12 +0400
I have just started to use NSScanner, and it obviously only finds
patterns from start. Here is an example:
NSScanner *myScanner;
NSString *animal = @"Cow";
myScanner = [NSScanner scannerWithString:@"ChickenAndTheCow"];
if([myScanner scanString:animal intoString:NULL]) {
NSLog(@"Animal");
} else {
NSLog(@"Not an animal");
}
This gives the result "Not an animal", but if I initialize NSString
*animal with "Chicken", this results in "Animal" in the log.
How can I get NSScanner to also recognize "Cow" in the string?
I also have a problem to understand what the parameter intoString: does.
Ivan