ios - how do I concatinate strings to create a url?

Posted by GeekedOut on Stack Overflow See other posts from Stack Overflow or by GeekedOut
Published on 2012-07-07T15:07:48Z Indexed on 2012/07/07 15:15 UTC
Read the original article Hit count: 157

Filed under:
|
|
|

I am trying to make a url by first collecting the parameters, and then in one statement creating the actual url. Here is what I am trying to do:

NSString *urlString = @"http://www.some_login_url.com?email=%@&password=%@";

NSString *email = self.email.text;
NSString *password = self.password.text;

NSString *url_to_send = [NSString stringWithFormat:@"%@%@", urlString , email , password];     

So what I wanted to do was replace the @ symbols with the values in the variables, but instead the second variable just got appended to the end of the string.

How would I change the last line so I could put the right parameters in their correct spots?

Thanks!!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios