Re:Stop the Hate: Obj-C Deserves Your Love
by vegashacker on Tuesday July 13, 2010 @12:35PM
(#1511875)
How do you create such a function though? stringWithFormat is built in.
Like any other vararg function:
+ (NSString) stringWithFormat: (NSString *) format, ... {
NSString *string;
va_list ap;
/* Fetch the arguments */
va_start(ap, format);
// Could iterate over the arguments yourself here, or just use:
CFStringRef cfString = CFStringCreateWithFormatAndArguments(NULL, NULL, (CFStringRef)format, args);
string = [NSMakeCollectable(cfString) autorelease];
va_end(ap);
return string;
}
Re:Stop the Hate: Obj-C Deserves Your Love
by bensummers on Tuesday July 13, 2010 @12:40PM
(#1511905)
Erm, not true. For example, NSString's