-2

我想转换以下字符串

      <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>

谢谢你

4

2 回答 2

0

应该这样做: -

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

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

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

于 2013-06-29T06:32:19.417 回答
0

答案: MWFeedParser

方法很多,如下图。您可以将它们用于您的目的。

  1. - (NSString *)stringByConvertingHTMLToPlainText;
  2. - (NSString *)stringByDecodingHTMLEntities;
  3. - (NSString *)stringByEncodingHTMLEntities;
  4. - (NSString *)stringByEncodingHTMLEntities:(BOOL)isUnicode;
  5. - (NSString *)stringWithNewLinesAsBRs;
  6. - (NSString *)stringByRemovingNewLinesAndWhitespace;

归功于迈克尔

于 2013-06-29T07:09:39.343 回答