NSString: Differences between initWithFormat and stringWithFormat
This actually came up in the following: I have a piece of code that creates an identifier string for an object:
Like this:
+(NSString *)createDictionaryKeyFromABC:(int)a b:(int)b c:(int)c
{
NSString *key = [[NSString alloc] initWithFormat: @"%d:%d:%d", a, b, c];
return key;
}
Usually, I only need to use those elements for a short time, so I find myself doing ... release right after usage. Is this a place where stringWithFormat would be better?
Thanks,
Tom
PC, Mac OS X (10.5.4)