stringByReplacingOccurrencesOfString小写& capitalizedString Objective-C

时间:2013-02-12 16:51:54

标签: iphone ios objective-c

我该如何解决这个问题?

NSString * vendorName=@"can't event";
vendorName= [[[vendorName stringByReplacingOccurrencesOfString:@" " withString:@"%20"]    stringByReplacingOccurrencesOfString:@"'" withString:@"\\\'"] capitalizedString];

我收到的输出是可以'T事件

但是,我需要结果不能事件

由于

1 个答案:

答案 0 :(得分:4)

NSString *vendorName=@"can't event";
vendorName= [[[vendorName capitalizedString] stringByReplacingOccurrencesOfString:@" " withString:@"%20"] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"];