5

I am new to iPhone development (using iOS 5) and I am trying to replace : with spaces in an NSMutableString. I have been struggling with this since an hour and it forces me to use replaceOccurrencesOfString:@":" withString:@" " options:nil range:; (I thought I could use it without options and range). I have tried almost everything (especially for the range parameter) but it keeps complaining about various stuff such as bad receiver type.

Any suggestions about how to achieve this?

Cemre Mengü
  • 18,062
  • 27
  • 111
  • 169

1 Answers1

11

This is how you invoke replaceOccurrencesOfString: to produce the desired effect:

[myString replaceOccurrencesOfString:@":"
                          withString:@" "
                             options:NSLiteralSearch
                               range:NSMakeRange(0, myString.length)];
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523