Nerver uses NSString to process strings, use NSMutableString . NSMutableString is a subclass of NSString and is used for this purpose.
From the Apple documentation:
The NSString class declares a programming interface for an object that manages immutable strings. (an immutable string is a text string that is defined when it is created and cannot subsequently be changed. NSString implemented to represent an array of Unicode characters (in other words, a text string).
The NSMutableString subclass of NSString is NSMutableString .
NSMutableString *word = [[NSMutableString alloc] initWithString:@"Hello"];
There is a more string manipulation function. See Apple documentation for NSMutableString.
Edited by:
you can first use rangeOfString to get the range of the string (in your case @ "e").
- (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask
then check the NSRange object, if valid, then use the replaceCharactersInRange function on your NSMutableString to replace the character set with your string.
- (void)replaceCharactersInRange:(NSRange)aRange withString:(NSString *)aString
source share