From dae7a239980b09ba446a00468b01f388692a90ba Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 22 May 2020 21:06:07 +0300 Subject: [PATCH] Clarify docs of CharSequence.split(Pattern, limit) Emphasize differences from Pattern.split(CharSequence, limit). #KT-39023 Fixed --- libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt b/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt index bd05adbd474..668fdf16069 100644 --- a/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt +++ b/libraries/stdlib/jvm/src/kotlin/text/StringsJVM.kt @@ -301,6 +301,11 @@ public inline fun String.Companion.format(locale: Locale?, format: String, varar /** * Splits this char sequence around matches of the given regular expression. + * + * This function has two notable differences from the method [Pattern.split]: + * - the function returns the result as a `List` rather than an `Array`; + * - when the [limit] is not specified or specified as 0, + * this function doesn't drop trailing empty strings from the result. * @param limit Non-negative value specifying the maximum number of substrings to return. * Zero by default means no limit is set.