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
|
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
|
// From stringsCode.kt
|
||||||
|
|
||||||
internal expect fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int
|
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.
|
* 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)
|
if (!ignoreCase)
|
||||||
return nativeStartsWith(prefix, 0)
|
return nativeStartsWith(prefix, 0)
|
||||||
else
|
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.
|
* 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)
|
if (!ignoreCase)
|
||||||
return nativeStartsWith(prefix, startIndex)
|
return nativeStartsWith(prefix, startIndex)
|
||||||
else
|
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.
|
* 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)
|
if (!ignoreCase)
|
||||||
return nativeEndsWith(suffix)
|
return nativeEndsWith(suffix)
|
||||||
else
|
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.
|
* 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)
|
if (!ignoreCase)
|
||||||
return (this as java.lang.String).startsWith(prefix)
|
return (this as java.lang.String).startsWith(prefix)
|
||||||
else
|
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.
|
* 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)
|
if (!ignoreCase)
|
||||||
return (this as java.lang.String).startsWith(prefix, startIndex)
|
return (this as java.lang.String).startsWith(prefix, startIndex)
|
||||||
else
|
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.
|
* 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)
|
if (!ignoreCase)
|
||||||
return (this as java.lang.String).endsWith(suffix)
|
return (this as java.lang.String).endsWith(suffix)
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user