From bb8df6be4b0bc1841f48ed48f94521b58764a426 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 27 Mar 2015 21:11:43 +0300 Subject: [PATCH] Restore startsWith and endsWith overloads taking single char to keep binary compatibility with markdown parser. --- libraries/stdlib/src/kotlin/text/Strings.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libraries/stdlib/src/kotlin/text/Strings.kt b/libraries/stdlib/src/kotlin/text/Strings.kt index d7b5977a634..9e88756feb2 100644 --- a/libraries/stdlib/src/kotlin/text/Strings.kt +++ b/libraries/stdlib/src/kotlin/text/Strings.kt @@ -468,15 +468,26 @@ public fun String.replaceBeforeLast(delimiter: String, replacement: String, miss /** * Returns `true` if this string starts with the specified character. */ -public fun String.startsWith(char: Char, ignoreCase: Boolean = false): Boolean = +public fun String.startsWith(char: Char, ignoreCase: Boolean): Boolean = this.length() > 0 && this[0].equals(char, ignoreCase) +/** + * Returns `true` if this string starts with the specified character. + */ +// TODO: temporary overload to keep binary compatibility, remove after fixing markdown parser +public fun String.startsWith(char: Char): Boolean = startsWith(char, ignoreCase = false) + /** * Returns `true` if this string ends with the specified character. */ -public fun String.endsWith(char: Char, ignoreCase: Boolean = false): Boolean = +public fun String.endsWith(char: Char, ignoreCase: Boolean): Boolean = this.length() > 0 && this[lastIndex].equals(char, ignoreCase) +/** + * Returns `true` if this string ends with the specified character. + */ +// TODO: temporary overload to keep binary compatibility, remove after fixing markdown parser +public fun String.endsWith(char: Char): Boolean = endsWith(char, ignoreCase = false) // indexOfAny()