Does anyone know how to (or if) you can convert a string to an enumerated type in the objective-c/cocoa/iphone environment?
For example:
If I have an XML document with the element:
<dog breed="GermanShepard">
I would like to be able to read the "breed" attribute into an NSString and then convert it into a type "Dogs" as defined here:
typedef enum
{
Poodle,
GoldenRetriever,
GermanShepard,
Collie
} Dogs;
Dogs myDog = <string that came from the breed attr in the XML>
Any assistance is appreciated...
Also, I just want to clarify that I AM able to retrieve the attr value from the XML (this is pretty straightforward). However, my issue is that once I have an NSString, I am unable to convert it to an enumerated type (ie. the Dog type in the example). I only included the XML example above as a means of illustrating why I would want to do such a thing.