Skip to content

Instantly share code, notes, and snippets.

@jamztang
Created January 8, 2012 14:19
Show Gist options
  • Save jamztang/1578509 to your computer and use it in GitHub Desktop.
Save jamztang/1578509 to your computer and use it in GitHub Desktop.
NSStringf. Simpler printf styled +[NSString stringWithFormat:]
//
// JTStringAddition.h
//
// Created by James Tang on 27/08/2011.
//
NSString *NSStringf(NSString *format, ...);
//
// JTStringAddition.m
//
// Created by James Tang on 27/08/2011.
//
#import "JTStringAddition.h"
NSString *NSStringf(NSString *format, ...) {
va_list ap;
NSString *str;
va_start(ap,format);
str=[[NSString alloc] initWithFormat:format arguments:ap];
va_end(ap);
return [str autorelease];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment