Is there a nice way in Kotlin to do a switch-case-...
# announcements
j
Is there a nice way in Kotlin to do a switch-case-like with String.startsWith? Something like this is what I have in mind (obviously
when
doesn't accept what I'm passing it there):
Copy code
fun fromArgs(args: Array<String>) {
            args.forEach {
                when (it.startsWith) {
                    "hibernate" -> hibernate.add(it)
                    "javax.persistence" -> otherlist.add(it)
                    ...
                    else -> log.info(it)
                }
            }
        }