fun main() { val s = "hello world" // everything before the first space println(s.substringBefore(" ")) // a fallback when the separator is absent println("nospace".substringBefore(" ", "none")) }
take text up to a separator