通过在“前面包含反斜杠来转换字符串”

时间:2013-06-29 06:21:50

标签: iphone replace

我想转换以下字符串

      <iframe width="560" height="314'' src="http://www.youtube.com" frameborder="0" allowfullscreen></iframe>

      <iframe width=\"560\" height=\"314\" src=\"http://www.youtube.com\" frameborder=\"0\" allowfullscreen></iframe>

谢谢

2 个答案:

答案 0 :(得分:0)

应该像: -

NSString *HtmlString = @"<iframe width="560" height="314' src="http://www.youtube.com" frameborder="0" allowfullscreen></iframe>";

HtmlString = [HtmlString stringByReplacingOccurrencesOfString:@""" withString:@"\""] ;

希望这有帮助....请查看编辑...

答案 1 :(得分:0)

答案: MWFeedParser

有很多方法如下所示。您可以将它们用于您的目的。

  1. - (NSString *)stringByConvertingHTMLToPlainText;
  2. - (NSString *)stringByDecodingHTMLEntities;
  3. - (NSString *)stringByEncodingHTMLEntities;
  4. - (NSString *)stringByEncodingHTMLEntities:(BOOL)isUnicode;
  5. - (NSString *)stringWithNewLinesAsBRs;
  6. - (NSString *)stringByRemovingNewLinesAndWhitespace;
  7. 信用转到Michael