提取NSString中的特定字符串 [英] extract specific string in NSString

查看:59
本文介绍了提取NSString中的特定字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这是一个简单的问题,但我不知道如何解决.

i think it is a simple question but i dont know how to solve it.

我有一个包含HTML内容的NSString.

i have a NSString that containes html content.

我想提取一些标签.

NSString *string=@"test some text <img src='http://www.xyz.com/a.jpg' > blah blah <a href='asdfg'>aaaa</a> bbbb cccc";

我想参加img&将"a"标记插入新字符串.然后我将其显示在UIWebView中.

i want to take img & "a" tag into new string. then i will display it in UIWebView.

我如何解析它?

推荐答案

您可以使用正则表达式,我已经使用该库在iPhone中抓取网页

You can use Regular Expressions, I have used this library to scrap web pages in the iPhone http://regexkit.sourceforge.net/RegexKitLite/index.html

这篇关于提取NSString中的特定字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆