How to I add text to the end of an NSString? Thanks
B Blakeasd macrumors 6502a Original poster Dec 29, 2009 643 0 May 4, 2011 #1 How to I add text to the end of an NSString? Thanks
lee1210 macrumors 68040 Jan 10, 2005 3,182 3 Dallas, TX 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 Mar 17, 2004 7,152 460 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.