HTML character decoding in Objective-C / Cocoa Touch

后端 未结 13 2239
我寻月下人不归
我寻月下人不归 2020-11-22 10:24

First of all, I found this: Objective C HTML escape/unescape, but it doesn\'t work for me.

My encoded characters (come from a RSS feed, btw) look like this: &a

13条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 10:55

    Check out my NSString category for HTML. Here are the methods available:

    - (NSString *)stringByConvertingHTMLToPlainText;
    - (NSString *)stringByDecodingHTMLEntities;
    - (NSString *)stringByEncodingHTMLEntities;
    - (NSString *)stringWithNewLinesAsBRs;
    - (NSString *)stringByRemovingNewLinesAndWhitespace;
    

提交回复
热议问题