开发者

How do I include a quote character in a string?

开发者 https://www.devze.com 2023-01-21 09:02 出处:网络
I have to make a web request but its format creates problem for me. I requirewww.abc.com?userID=\"YourUserID\"

I have to make a web request but its format creates problem for me.

I require www.abc.com?userID="YourUserID"

I am creating following ...

NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.abc.com?userID=%@",myID]开发者_如何学Python];

... which will create a url with string www.abc.com?userID=12345.

But I require www.abc.com?userID="12345"

I tried to put following:

NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.abc.com?userID="%@"",myID]];


[NSURL URLWithString:
    [NSString stringWithFormat:@"http://www.abc.com?userID=\"%@\"", myID]];
0

精彩评论

暂无评论...
验证码 换一张
取 消