hey all i want a code the replace whitespaces by a + sign in objective-c
+1
A:
return [thatString stringByReplacingOccurrencesOfString:@" " withString:@"+"];
If your real target is to escape URL component, use the -stringByAddingPercentEscapesUsingEncoding:
method instead.
KennyTM
2010-08-14 13:59:57
+3
A:
In case you are asking this because you need to encode URLs, use this
NSString* escapedUrlString =
[unescapedString stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];
If you just need space to +, use
[str stringByReplacingOccurrencesOfString:@" " withString:@"+"];
Lou Franco
2010-08-14 14:04:52