urldecode in objective-c

前端 未结 6 1750
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 10:19

I\'m dealing with an urlencoded string in objective-c. Is there a foundation function that actually reverse the urlENCODING?

The string received is like: K%FChlschr

6条回答
  •  一整个雨季
    2020-12-05 10:32

    I believe this is what you are looking for:

    - (NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
    

    Return Value:

    A new string made by replacing in the receiver all percent escapes with the matching characters as determined by the given encoding. It returns nil if the transformation is not possible, for example, the percent escapes give a byte sequence not legal in encoding.

    [source: Apple NSString Class Reference]
    

提交回复
热议问题