3 ms·
How do you create such a function though? stringWithFormat is built in.
by vegashacker 16y ago
How do you create such a function though? stringWithFormat is built in.
- bensummers 16y agohttp://developer.apple.com/mac/library/qa/qa2005/qa1405.html http://developer.apple.com/mac/library/qa/qa2005/qa1405.html
- ant5 16y agoLike 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; }
- famfam 16y agoIt's the same as in C. va_list, va_start, va_arg, va_end, etc.