gpt4 book ai didi

iphone - 如何在表格单元格中显示 HTML 标签之前从我的 Feed 中删除它们?

转载 作者:行者123 更新时间:2023-12-03 21:06:31 27 4
gpt4 key购买 nike

我正在阅读一个 feed,它提供带有一些 html 标签的数据,例如

<p> this is a test string </p>.

我需要在 UITableViewCell 中显示它。我遇到的问题是,html 标签也会显示。我怎样才能只显示没有html标签的文本.??

非常感谢任何帮助......!!!

谢谢

最佳答案

只需在将字符串添加到表格 View 之前通过一些剥离代码运行该字符串即可。

NSString *str = @"<p> this is a test string </p>";

str = [str stringByReplacingOccurrencesOfString:@"<p>" withString:@""];
str = [str stringByReplacingOccurrencesOfString:@"</p>" withString:@""];
str = [str stringByReplacingOccurrencesOfString:@"<h1>" withString:@""];
str = [str stringByReplacingOccurrencesOfString:@"</h1>" withString:@""];
//etc....

//new string equals @"this is a test string"

关于iphone - 如何在表格单元格中显示 HTML 标签之前从我的 Feed 中删除它们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6599410/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com