Quantcast
Viewing latest article 3
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 latest article 3
Browse Latest Browse All 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>