B Blakeasd macrumors 6502a Original poster May 4, 2011 #1 How to I add text to the end of an NSString? Thanks
lee1210 macrumors 68040 May 4, 2011 #2 Blakeasd said: How to I add text to the end of an NSString? Thanks Click to expand... You don't, NSString is immutable. there is stringByAppendingString: which will return a new, autoreleased NSString with the current value plus the NSString passed in, but if you need to be altering a string "in place" you need NSMutableString. It has an appendString: method. -Lee
Blakeasd said: How to I add text to the end of an NSString? Thanks Click to expand... You don't, NSString is immutable. there is stringByAppendingString: which will return a new, autoreleased NSString with the current value plus the NSString passed in, but if you need to be altering a string "in place" you need NSMutableString. It has an appendString: method. -Lee
GFLPraxis macrumors 604 May 4, 2011 #3 Blakeasd said: How to I add text to the end of an NSString? Thanks Click to expand... Create a new NSString with the new one added (either through stringByAppendingString or @"%@ blah blah",oldstring). Or use NSMutableStrings.
Blakeasd said: How to I add text to the end of an NSString? Thanks Click to expand... Create a new NSString with the new one added (either through stringByAppendingString or @"%@ blah blah",oldstring). Or use NSMutableStrings.