title: Is there a way to cast from 'String' to 'KType'?
body: <p>Simply, I want a function like:</p>
  
  <pre><code>fun &lt;T&gt; convert(val foo: String, fooT: KType) : T {
      ...?
  }
  </code></pre>
  
  <p>For <code>Int</code>, it would return <code>foo.toInt()</code>, for <code>Double</code>, <code>foo.toDouble()</code>, and to some unknown type, just throw an exception. I think it's not so hard to create my own switch statement for the types I expect, but out of curiosity - is there a way already?</p>