String.compareTo: SinceKotlin in JS and common, restore default parameter value in JVM
Default parameter is required to generate docs with Dokka for now. #KT-18067
This commit is contained in:
@@ -158,6 +158,13 @@ expect fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: B
|
|||||||
*/
|
*/
|
||||||
expect fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean
|
expect fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two strings lexicographically, optionally ignoring case differences.
|
||||||
|
*/
|
||||||
|
@SinceKotlin("1.2")
|
||||||
|
expect fun String.compareTo(other: String, ignoreCase: Boolean = false): Int
|
||||||
|
|
||||||
|
|
||||||
// From stringsCode.kt
|
// From stringsCode.kt
|
||||||
|
|
||||||
internal inline expect fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int
|
internal inline expect fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int
|
||||||
@@ -290,11 +297,6 @@ expect fun Int.toString(radix: Int): String
|
|||||||
@SinceKotlin("1.2")
|
@SinceKotlin("1.2")
|
||||||
expect fun Long.toString(radix: Int): String
|
expect fun Long.toString(radix: Int): String
|
||||||
|
|
||||||
/**
|
|
||||||
* Compares two strings lexicographically, optionally ignoring case differences.
|
|
||||||
*/
|
|
||||||
expect fun String.compareTo(other: String, ignoreCase: Boolean = false): Int
|
|
||||||
|
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal expect fun checkRadix(radix: Int): Int
|
internal expect fun checkRadix(radix: Int): Int
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,9 @@ public inline val CharSequence.size: Int get() = length
|
|||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
internal inline fun String.nativeReplace(pattern: RegExp, replacement: String): String = asDynamic().replace(pattern, replacement)
|
internal inline fun String.nativeReplace(pattern: RegExp, replacement: String): String = asDynamic().replace(pattern, replacement)
|
||||||
|
|
||||||
public actual fun String.compareTo(other: String, ignoreCase: Boolean): Int {
|
@SinceKotlin("1.2")
|
||||||
|
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||||
|
public actual fun String.compareTo(other: String, ignoreCase: Boolean = false): Int {
|
||||||
if (ignoreCase) {
|
if (ignoreCase) {
|
||||||
val n1 = this.length
|
val n1 = this.length
|
||||||
val n2 = other.length
|
val n2 = other.length
|
||||||
|
|||||||
@@ -317,7 +317,8 @@ public inline fun String.codePointCount(beginIndex: Int, endIndex: Int): Int =
|
|||||||
/**
|
/**
|
||||||
* Compares two strings lexicographically, optionally ignoring case differences.
|
* Compares two strings lexicographically, optionally ignoring case differences.
|
||||||
*/
|
*/
|
||||||
public actual fun String.compareTo(other: String, ignoreCase: Boolean): Int {
|
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||||
|
public actual fun String.compareTo(other: String, ignoreCase: Boolean = false): Int {
|
||||||
if (ignoreCase)
|
if (ignoreCase)
|
||||||
return (this as java.lang.String).compareToIgnoreCase(other)
|
return (this as java.lang.String).compareToIgnoreCase(other)
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user