I have a preprocessor macro defined in build settings
FOO=BAR
That value I want to massage into an Objective-C string literal that can be passe
Here's a modified version of Adam Rosenfield's answer with clearer semantics:
#define NSStringize_helper(x) #x
#define NSStringize(x) @NSStringize_helper(x)
I use it to replace code like this:
case OneEnumValue: name = @"OneEnumValue"; break;
case AnotherEnumValue: name = @"AnotherEnumValue"; break;
with this:
#define case_for_type(type) case type: name = NSStringize(type); break
case_for_type(OneEnumValue);
case_for_type(AnotherEnumValue);