How do I enumerate on NSString?
example of what I am trying to do:
enum eCat{
dog,
cat,
mouse,
bunny
};
@interface
@implementation
....
enum eCat Cate;
NSString *yoda = @"mouse";
Cate = [yoda intValue];
NSLog(@"Hello: %d",Cate);
wanting the result to be
Hello: 2
thanks
You have to create a mapping (string → enumeration) yourself. One possibility would be something like this (disclaimer: only brain-compiled):