0

可能重复:
如何在 Xcode 中用 + 替换空格

在这个字符串中,我需要替换空格:

controller.body = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@@%@,%@", pinTitle.text, newlatLabel.text, newlogLabel.text];
4

2 回答 2

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;
于 2012-06-05T13:49:43.263 回答
1

认为你正在寻找这个:

  NSString *finalString = [controller.body stringByReplacingOccurrencesOfString:@" " withString:@"+"];
于 2012-06-05T13:50:58.860 回答