Objective-C url encode/urldecode url加密解密
-(
NSString
*)urlEncoded:(
NSString
*)str {
//相当于encode
NSString
*encodeUrlString = [str stringByAddingPercentEscapesUsingEncoding:
NSASCIIStringEncoding
];
return
encodeUrlString;
}
-(
NSString
*)urlDecoded:(
NSString
*)str {
//相当于decode
NSString
*decodeUrlString = [str stringByReplacingPercentEscapesUsingEncoding:
NSASCIIStringEncoding
];
return
decodeUrlString;
}