An enum doesn't satisfy what you are requesting in post #3. However, the best you could do is use a Trie to get an integer (that is associated with the input string) to use in your switch.
Based on the purpose of the code in post #1, you should be using integers or enums anyways. I'm glad you found the answer.
All 'good' scripters try stuff on their own before asking "will this work" unless it's extremely complicated.