Created
January 5, 2014 20:24
-
-
Save jensellfors/8273360 to your computer and use it in GitHub Desktop.
String concatenation in Objective-C, using one line of code. Takes a list of NSObject and concatenates their description.
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 $(...) ((NSString *)[[NSArray arrayWithObjects:__VA_ARGS__, nil] componentsJoinedByString:@""]) | |
/* | |
* Example | |
*/ | |
NSString *string = $(@"Hello", @" ", @"World!", @"\n", @"1 + 2 = ", @(1+2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment