News for hackers. Stuff that matters.
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.
Re:Stop the Hate: Obj-C Deserves Your Love by ant5 on Tuesday July 13, 2010 @12:42PM (#1511919)
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)
Re:Stop the Hate: Obj-C Deserves Your Love by famfam on Tuesday July 13, 2010 @12:42PM (#1511920)
It's the same as in C. va_list, va_start, va_arg, va_end, etc.