<分区>
<分区>
我如何解码应该删除或替换为适当字符的 html,例如
应该替换为“”(空格)。
其他特殊字符呢?
最佳答案
您可以自己创建一个方法,如下所示:
+ (NSString *) replaceHTMLEntitiesInString:(NSString *) htmlString {
htmlString = [htmlString stringByReplacingOccurrencesOfString:@" " withString:@" "];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@""" withString:@"\""];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"<" withString:@"<"];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@">" withString:@">"];
return htmlString;
}
关于html - 需要解码为 html 中的空格和其他特殊字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20801131/
相关文章:
android - 在 iOS 和 Android 上跨平台使用静态 .a-library 可能吗? (那么 .so 和 .dylib 呢?)
objective-c - NSURLConnection接收到数据后如何返回数据
css - 无法在 HTML + CSS Slider 中添加图像
javascript - 有没有办法创建 "inline-none"CSS 效果?将被隐藏,但保留它在页面上占用的空间
ios - 如何在多个ViewController中使用NSFetchedResultsControllerDelegate而不重复 Controller 代码?
iphone - 在编译 iPhone 应用程序时,armv7 相对于 armv6 的优势是什么?