# Can't call String.split with Char?

**URL:** <https://discuss.kotlinlang.org/t/cant-call-string-split-with-char/19297>\
**Category:** Support\
**Created:** [September 26, 2020, 1:12am UTC](https://discuss.kotlinlang.org/t/cant-call-string-split-with-char/19297 "2020-09-26T01:12:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rnikander](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/rnikander/32/6881_2.png) [@rnikander](https://discuss.kotlinlang.org/u/rnikander)\
**Post date:** [September 26, 2020, 1:12am UTC](https://discuss.kotlinlang.org/t/cant-call-string-split-with-char/19297/1 "2020-09-26T01:12:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nickallendev](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@nickallendev](https://discuss.kotlinlang.org/u/nickallendev)\
**Post date:** [September 26, 2020, 3:28am UTC](https://discuss.kotlinlang.org/t/cant-call-string-split-with-char/19297/2 "2020-09-26T03:28:48Z")

</div>

You have to name all arguments after vararg.

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

```

---

<div class="post-metadata">

**Author:** ![rnikander](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/rnikander/32/6881_2.png) [@rnikander](https://discuss.kotlinlang.org/u/rnikander)\
**Post date:** [September 26, 2020, 3:44am UTC](https://discuss.kotlinlang.org/t/cant-call-string-split-with-char/19297/3 "2020-09-26T03:44:41Z")

</div>

Thanks.

---

<div class="post-metadata">

**Author:** ![vpmalley](https://avatars.discourse-cdn.com/v4/letter/v/a8b319/32.png) [@vpmalley](https://discuss.kotlinlang.org/u/vpmalley)\
**Post date:** [September 17, 2025, 5:52pm UTC](https://discuss.kotlinlang.org/t/cant-call-string-split-with-char/19297/4 "2025-09-17T17:52:59Z")

</div>

Apparently Android Studio/Gradle doesn’t like if I name the `delimiters` vararg argument though

---

<div class="post-metadata">

**Author:** ![Landei](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/landei/32/9407_2.png) [@Landei](https://discuss.kotlinlang.org/u/Landei)\
**Post date:** [September 17, 2025, 7:41pm UTC](https://discuss.kotlinlang.org/t/cant-call-string-split-with-char/19297/5 "2025-09-17T19:41:07Z")

</div>

It’s not Android Studio or Gradle, it’s the compiler, and it behaves as documented: As soon as you call a vararg as a named argument, you have to pass the individual arguments packed as an array. This should work:

```auto
s.split(delimiters = charArrayOf(':'), ignoreCase = true, limit = 1)

```
