Join Slack
Powered by
i'm trying to create a silly function which takes ...
# getting-started
t
tipsy
09/12/2018, 5:55 PM
i'm trying to create a silly function which takes a string and a class, then converts the string to that class:
Copy code
fun cast(str: String, clazz: Class<*>) = when { clazz is Int -> str.toInt() }
but i'm having some trouble with what exactly i'm supposed to compare
Open in Slack
Previous
Next