Advertise with Googlier.com HJ Code Snippet > 6, er, 8 ways to do the same thing
The general idea is that you have a string you need to compare against a set of possible values and then assign a variable a certain enum value based on that.

Update: I should have mentioned that I was mentally assuming that the -isEqualToString: comparison could become more complex. That said, as given there are two other fine ways to skin this cat, as pointed out by Dmitri and Rainer, just moments after tweeting the link. I've added them as options 7 and 8 below. If the specific case of -isEqualToString: is at issue, then I think option #8 is the most elegant.

[code]]]>
http://blog.hyperjeff.net/code?id=337 en-us hyperjeff@mac.com David H http://blog.hyperjeff.net/code?id=337#comment859 Mon, 15 Jul 2013 21:39:26 +0000 http://blog.hyperjeff.net/code?id=337#comment859 Jeff #1: 9.7k
#2: 14k
#3: 14k
#4: 14k
#5: 14k
#6: 14k
#7: 9.8k
#8: 9.6k

and if you compile the version with all of them in there: 15k. :o)]]>
http://blog.hyperjeff.net/code?id=337#comment860 Mon, 15 Jul 2013 22:17:57 +0000 http://blog.hyperjeff.net/code?id=337#comment860
Andrew G http://blog.hyperjeff.net/code?id=337#comment861 Tue, 16 Jul 2013 14:22:42 +0000 http://blog.hyperjeff.net/code?id=337#comment861 Jeff http://blog.hyperjeff.net/code?id=337#comment862 Tue, 16 Jul 2013 17:53:00 +0000 http://blog.hyperjeff.net/code?id=337#comment862