我正在尝试格式化网址,但我发现了一个错误。我的代码如下。
NSString *twitterURL = [NSString stringWithFormat:@"http://twitter.com/?status=My%20score%20is:%i%20and%20CharsPerMin%20is:%@", currentScore, charPerMin.text];
调用方法时,它没有做任何事情。我认为问题出在%20
上。 %20
用于区分网址中的每个字词。
答案 0 :(得分:3)
你需要通过加倍来逃避你的%
标志:
NSString *twitterURL = [NSString stringWithFormat:@"http://twitter.com/?status=My%%20PracticeTyper%%20score%%20is:%i%%20and%%20CharsPerMin%%20is:%@", currentScore, charPerMin.text];