Reputation: 5413
NSString * url;
NSString * device;
NSString * API;
API = @"http://www.test/";
device = @"test123";
url = [NSString stringWithFormat:@"%@update.json?dev=%20%20%20%@", API, device];
I want the final url to http://www.test/update.json?dev=%20%20%20%20test123; However the above I get only http://www.test/update.json?dev=22020test123; I want those %20 be part of literal string of url. How can I accomplish that?
Upvotes: 1
Views: 2617
Reputation: 2169
To make a %
sign since it's a special character you need to put %%
for each %
within an NSString.
Upvotes: 5