Preethi
Preethi

Reputation: 195

stringByReplacingOccurrencesOfString lowercase & capitalizedString Objective-C

How can i solve the problem ?

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

Output i am receiving is Can\'T Event

But, i need result as Can\'t Event

Thanks

Upvotes: 1

Views: 273

Answers (1)

Rajneesh071
Rajneesh071

Reputation: 31091

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

Upvotes: 4

Related Questions