title: How do I create an enum from a string in Kotlin?
body: <p>I have an enum with some instances <code>Foo</code> and <code>Bar</code>.  If I have a string <code>"Foo"</code>, how can I instantiate a <code>Foo</code> enum from that?  In C# it would be <code>Enum.Parse(...)</code>, is there an equivalent in Kotlin?</p>
  
  <p>Currently, the best I have found is to create a factory that switches on all possible strings, but that is error prone and performs poorly for large enumerations.</p>