在这个字符串中我需要替换空格:
controller.body = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@@%@,%@", pinTitle.text, newlatLabel.text, newlogLabel.text];
答案 0 :(得分:12)
像:
NSString *finalString = [controller.body stringByReplacingOccurrencesOfString:@" " withString: @"+"];
controller.body = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@@%@,%@", pinTitle.text, newlatLabel.text, newlogLabel.text];
NSString *finalString = [controller.body stringByReplacingOccurrencesOfString:@" " withString: @"+"];
controller.body = finalString;
答案 1 :(得分:1)
认为你正在寻找这个:
NSString *finalString = [controller.body stringByReplacingOccurrencesOfString:@" " withString:@"+"];