Muju Muju - 1 year ago 127
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

Answer Source

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];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download