I have to get city name from a user and send a URL. How URLs will not accept blank characters, so I need to:
Detecting a whitespace in on a NSString, and then insert a cacaractere this space.
I have to get city name from a user and send a URL. How URLs will not accept blank characters, so I need to:
Detecting a whitespace in on a NSString, and then insert a cacaractere this space.
Try this
NSString * oldString = @"http://www.domain.com/my city";
NSString * finalString = [oldString stringByReplacingOccurrencesOfString:@" " withString:@"%20"];