码迷,mamicode.com
首页 > Web开发 > 详细

NSString+URLEncoding

时间:2016-01-17 13:32:36      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:

NSString+URLEncoding.h

技术分享
#import <Foundation/Foundation.h>

@interface NSString(URLEncoding)

- (NSString *)urlEncodeString;

@end
技术分享

NSString+URLEncoding.m

技术分享
#import "NSString+URLEncoding.h"

@implementation NSString(URLEncoding)
- (NSString *)urlEncodeString
{
    NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, 
                (CFStringRef)self, 
                NULL, 
                (CFStringRef)@";/?:@&=$+{}<>,",
                kCFStringEncodingUTF8);
    return [result autorelease];
}
@end
技术分享

NSString+URLEncoding

标签:

原文地址:http://www.cnblogs.com/56ik/p/5137074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!