From 5f319e69d88349429a47c250873695ae49961082 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 26 May 2015 20:37:51 +0300 Subject: [PATCH] Restore String.split(String, Int) overload and make it deprecated. --- libraries/stdlib/src/kotlin/text/StringsJVM.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/stdlib/src/kotlin/text/StringsJVM.kt b/libraries/stdlib/src/kotlin/text/StringsJVM.kt index c2237f76778..270f9da5f2b 100644 --- a/libraries/stdlib/src/kotlin/text/StringsJVM.kt +++ b/libraries/stdlib/src/kotlin/text/StringsJVM.kt @@ -130,9 +130,14 @@ public fun String.split(regex: Pattern, limit: Int = 0): List /** * Splits this string around matches of the given regular expression. */ -deprecated("Convert an argument to regex with toRegex or use splitBy instead.") -public fun String.split(regex: String): Array = split(regex.toRegex()).toTypedArray() +deprecated("Convert String argument to regex with toRegex or use splitBy instead.") +public fun String.split(regex: String): Array = (this as java.lang.String).split(regex) +/** + * Splits this string into at most [limit] chunks around matches of the given regular expression. + */ +deprecated("Convert String argument to regex with toRegex or use splitBy instead.") +public fun String.split(regex: String, limit: Int): Array = (this as java.lang.String).split(regex, limit) /** * Returns a substring of this string starting with the specified index.