开发者

Which is the fastest way to get a URL from an HTML tag (Regex, NScanner, Hppple)?

I found 3 different way to get the value of the src attribute of an img tag in an HTML string.

  1. With a Regex using RegexKitLite.
  2. With TFHpple HTML parser
  3. Using a NSSCanner to scan the HTML string.
开发者_开发知识库

So which way I must use to optimize performance of my iPhone app?


Maybe not the fastest, but RegEx is imho the most versatile and portable method. And unless you're really doing hundreds of parses per second, you won't notice the performance hit you'll get by not using the fastest method around..

I use lots of regexes on iPhone for user input validation while the user is entering text (so a lag would certainly be seen). Never had any problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜