Append to a NSString

August 26, 2008    Programming Snippets

I was working on appending to some strings and there is a way to do it with NSString but you are better off working with NSMutableString instead. I have a feeling doing it with NSString, if not done correctly, will leak memory.

NSMutableString *hello = [[NSMutableString alloc] initWithString:@"Hello"];
[hello appendString:@" World"];

comments powered by Disqus