I am trying to scan for a specific string in an html file, assign it to an NSString then do things with the NSString. If it matters, I am doing this in Cocos2d.
My code looks like this:
NSScanner *scanner = [NSScanner scannerWithString: htmlCodeString];
NSString* string;
[scanner scanUpToString:@"HTML CODE" intoString:NULL];
[scanner scanString:@"HTML CODE" intoString:NULL];
[scanner scanUpToString:@"STRING I NEED" intoString: &string];
NSLog(@"%@", string);
When I run the code, NSLog prints the name of the layer I am executing the code in.
I am confused because I followed this example by Apple to a T: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/Scanners.html#//apple_ref/doc/uid/20000147-BCIEFGHC (scroll to the bottom)
Any advice would be greatly appreciated.