Align JS String.equals/compareTo(ignoreCase) behavior with JVM #KT-48999

This commit is contained in:
Abduqodiri Qurbonzoda
2021-09-30 15:35:50 +00:00
committed by Space
parent b5f74ef9a6
commit f8bcba0b76
8 changed files with 77 additions and 30 deletions
@@ -270,12 +270,17 @@ expect fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: B
/**
* Returns `true` if this string is equal to [other], optionally ignoring character case.
*
* Two strings are considered to be equal if they have the same length and the same character at the same index.
* If [ignoreCase] is true, the result of `Char.uppercaseChar().lowercaseChar()` on each character is compared.
*
* @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
*/
expect fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean
/**
* Compares two strings lexicographically, optionally ignoring case differences.
*
* If [ignoreCase] is true, the result of `Char.uppercaseChar().lowercaseChar()` on each character is compared.
*/
@SinceKotlin("1.2")
expect fun String.compareTo(other: String, ignoreCase: Boolean = false): Int