Clearing rather than releasing a NSMutableString

Rudiger picture Rudiger · Jul 26, 2010 · Viewed 8k times · Source

I've got a rather large loop that gets a string, does something to it, than goes onto the next one. I was originally releasing it then reallocating it but thought that is a bit of waste of resources but can't figure out how to just clear it out to reuse it.

Answer

JWWalker picture JWWalker · Jul 26, 2010

One way would be [myString setString: @""].