Is there a more intelligent way to rewrite this?
if ([cardName isEqualToString:@\"Six\"]) { [self setValue:6]; } else if ([cardName isEqualToString:@\"Se
You can use macros approach to achieve it:
#define CASE(str) if ([__s__ isEqualToString:(str)]) #define SWITCH(s) for (NSString *__s__ = (s); ; ) #define DEFAULT SWITCH (string) { CASE (@"AAA") { break; } CASE (@"BBB") { break; } CASE (@"CCC") { break; } DEFAULT { break; } }