我希望实现与stringWithFormat
方法相同的功能。
我想知道你是否可以在#define
内调用另一个常量?
e.g。 [NSString stringWithFormat:@"If you enjoyed %@ would you mind please reviewing it?", appName];
我想:
#define appName @"This App"
#define myMessage @"If you enjoyed **appName** would you mind please reviewing it?"
由于
答案 0 :(得分:5)
#import <Foundation/Foundation.h>
#define appName @"This App"
#define myMessage @"If you enjoyed " appName @" would you mind please reviewing it?"
int main( void )
{
@autoreleasepool
{
NSLog( myMessage );
}
return 0;
}