Provide expect declarations for String.startsWith/endWith overloads
Mark the existing declarations as actual.
This commit is contained in:
@@ -175,6 +175,10 @@ expect fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean
|
||||
expect fun String.compareTo(other: String, ignoreCase: Boolean = false): Int
|
||||
|
||||
|
||||
public expect fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean
|
||||
public expect fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean
|
||||
public expect fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean
|
||||
|
||||
// From stringsCode.kt
|
||||
|
||||
internal expect fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int
|
||||
|
||||
@@ -16,7 +16,8 @@ internal actual inline fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): I
|
||||
/**
|
||||
* Returns `true` if this string starts with the specified prefix.
|
||||
*/
|
||||
public fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean {
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean {
|
||||
if (!ignoreCase)
|
||||
return nativeStartsWith(prefix, 0)
|
||||
else
|
||||
@@ -26,7 +27,8 @@ public fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boole
|
||||
/**
|
||||
* Returns `true` if a substring of this string starting at the specified offset [startIndex] starts with the specified prefix.
|
||||
*/
|
||||
public fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean {
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean {
|
||||
if (!ignoreCase)
|
||||
return nativeStartsWith(prefix, startIndex)
|
||||
else
|
||||
@@ -36,7 +38,8 @@ public fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolea
|
||||
/**
|
||||
* Returns `true` if this string ends with the specified suffix.
|
||||
*/
|
||||
public fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean {
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean {
|
||||
if (!ignoreCase)
|
||||
return nativeEndsWith(suffix)
|
||||
else
|
||||
|
||||
@@ -191,7 +191,8 @@ public actual inline fun String.substring(startIndex: Int, endIndex: Int): Strin
|
||||
/**
|
||||
* Returns `true` if this string starts with the specified prefix.
|
||||
*/
|
||||
public fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean {
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean {
|
||||
if (!ignoreCase)
|
||||
return (this as java.lang.String).startsWith(prefix)
|
||||
else
|
||||
@@ -201,7 +202,8 @@ public fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boole
|
||||
/**
|
||||
* Returns `true` if a substring of this string starting at the specified offset [startIndex] starts with the specified prefix.
|
||||
*/
|
||||
public fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean {
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean {
|
||||
if (!ignoreCase)
|
||||
return (this as java.lang.String).startsWith(prefix, startIndex)
|
||||
else
|
||||
@@ -211,7 +213,8 @@ public fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolea
|
||||
/**
|
||||
* Returns `true` if this string ends with the specified suffix.
|
||||
*/
|
||||
public fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean {
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean {
|
||||
if (!ignoreCase)
|
||||
return (this as java.lang.String).endsWith(suffix)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user