Created
April 26, 2018 12:29
-
-
Save leilee/fddd96317d464e39fa845213a551c332 to your computer and use it in GitHub Desktop.
NSString StringWithFormat using asprintf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define STRING_WITH_FORMAT(format, ...) \ | |
({ \ | |
char *buffer; \ | |
asprintf(&buffer, format, ##__VA_ARGS__); \ | |
NSString* result = [NSString stringWithUTF8String:buffer]; \ | |
free(buffer); \ | |
result; \ | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment