(Adding always means adding to the end. This is the insertion of a line in the middle.)
If you just want to build a literal string, use
#define STR1 @"Hello"
NSString* str2 = @"Hi..." STR1 @" how r u??";
To insert it at runtime, you need to convert str2 to a mutable string and call -insertString:atIndex:.
NSMutableString* mstr2 = [str2 mutableCopy];
[mstr2 insertString:str1 atIndex:4];
return [mstr2 autorelease];
source
share