Muju Muju - 11 months ago 50
Objective-C Question

how to replace the content of NSMutablestring in objective c

I am new in objective c. I want to replace the content of mutable string I am using code as

NSMutableString *myMutableStringObj = [myMutableStringObj stringByReplacingOccurrencesOfString:@" & " withString:@"And"];

But It Shows me warning
Incomparable pointer types assigning to
NSMutableString *
NSString *

Any Suggestion about this. I am using


It tells you this function returns NSString *. If you want to clean that warning. Just do like this:

NSMutableString *myMutableStringObj = [[myMutableStringObj stringByReplacingOccurrencesOfString:@" & " withString:@"And"] mutableCopy];