Can't call String.split with Char?

It’s late in the day and I’m probably doing something stupid…

val s: String = ...
s.split(':', true, 1)  // error

This fails with the error below. Why can’t I call the second one?

None of the following functions can be called with the arguments supplied:
public fun CharSequence.split(vararg delimiters: String, ignoreCase: Boolean = …, limit: Int = …): List defined in kotlin.text
public fun CharSequence.split(vararg delimiters: Char, ignoreCase: Boolean = …, limit: Int = …): List defined in kotlin.text
private fun CharSequence.split(delimiter: String, ignoreCase: Boolean, limit: Int): List defined in kotlin.text

You have to name all arguments after vararg.

val s: String = ... 
s.split(':', ignoreCase = true, limit = 1)
1 Like

Thanks.