Search code examples
objective-cnsscanner

Objective-C - Using NSScanner to read string?


SO I am trying to read content of an html string.

[scanner scanUpToString:@"<" intoString:&result];

What is the fastest way to read the content into string but ignore the last character which in this case is "<". I don't want to do stringByReplacingOccuranceOfString, that would perform slow


Solution

  • NSScanner's

    -scanUpToString:(NSString *)stopString intoString:(NSString *)result

    does not include the stopString in the result; you don't need to ignore the last character, because it's not included.