0

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

aryaxt
  • 76,198
  • 92
  • 293
  • 442

1 Answers1

2

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.

beryllium
  • 29,669
  • 15
  • 106
  • 125
Scott Austin
  • 356
  • 1
  • 4
  • oo my bad, I meant remove the first character, because I am scanning from "<" to ">", so the problem is having a "<" at the beginning of the string – aryaxt Nov 18 '11 at 19:34
  • @aryaxt Put a `[scanner scanString:@"<" intoString:nil]` before scanning the content to skip it. `@Scott` You're missing an asterisk on the `result` parameter: `(NSString **)result`; – ughoavgfhw Nov 18 '11 at 19:52