Most memory efficient way to split an NSString in to substrings

前端 未结 2 1912
走了就别回头了
走了就别回头了 2021-01-15 03:29

I have the following code:

    int start = [html rangeOfString:@\"class=WordSection1>\"].location + 24;
    int end = [html rangeOfString:@\"
2条回答
  •  独厮守ぢ
    2021-01-15 04:05

    Parsing HTML using rangeOfString:, NSScanner or regular expressions is futile. It might work for your test case, but it is going to break as soon as the HTML changes.

    I.e. keep in mind that:

    And:

    Are both identical in terms of the class attribute.

    Use a proper HTML parser.

提交回复
热议问题