0

Possible Duplicate:
How do i replace spaces with +'s in Xcode

In this string I need to replace spaces:

controller.body = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@@%@,%@", pinTitle.text, newlatLabel.text, newlogLabel.text];
Community
  • 1
  • 1
Pavel Kaljunen
  • 1,291
  • 2
  • 26
  • 53

2 Answers2

12

Like:

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;
Rui Peres
  • 25,741
  • 9
  • 87
  • 137
1

Think you are looking for this:

  NSString *finalString = [controller.body stringByReplacingOccurrencesOfString:@" " withString:@"+"];
Zaid Amir
  • 4,727
  • 6
  • 52
  • 101