Quantcast
Viewing all articles
Browse latest Browse all 5

Answer by paspielka for starts with inside switch statement Kotlin

I found an answer on how to do it without tons of repetition.you can do it like this:

val str = "!settings change something"val args = str.split(" ")when (args[0]) {"!settings" -> TODO()"!other" -> TODO()}

By doing it like this you don't have that much repetition because when having hundreds of cases you don't want to repeat writing msg.startsWith


Viewing all articles
Browse latest Browse all 5

Trending Articles