Advertise with Googlier.comHJ 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.
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 +0000http://blog.hyperjeff.net/code?id=337#comment860Andrew G
http://blog.hyperjeff.net/code?id=337#comment861
Tue, 16 Jul 2013 14:22:42 +0000http://blog.hyperjeff.net/code?id=337#comment861Jeff
http://blog.hyperjeff.net/code?id=337#comment862
Tue, 16 Jul 2013 17:53:00 +0000http://blog.hyperjeff.net/code?id=337#comment862