Created
November 5, 2018 10:54
-
-
Save serkodev/8040e0b320ca3436c839571b3a7dc482 to your computer and use it in GitHub Desktop.
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
| //Credit: https://stackoverflow.com/questions/1793882/how-to-make-a-macro-that-can-take-a-string | |
| #define STRINGIFY2(x) #x | |
| #define STRINGIFY(x) STRINGIFY2(x) | |
| #define PASTE2(a, b) a##b | |
| #define PASTE(a, b) PASTE2(a, b) | |
| #define PRINTTHIS(text) \ | |
| NSLog(PASTE(@, STRINGIFY(text))); | |
| //Result | |
| #define PRINTTHIS(abcde) \ | |
| NSLog(@"abcde"); | |
| //Result | |
| #define abcde ongggg | |
| NSLog(@STRINGIFY(abcde)); | |
| //output: ongggg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment