JS backend: using native implementations in kotlin_lib.js for String.startsWith, String.endsWith and String.contains.
This commit is contained in:
@@ -25,21 +25,14 @@ public inline fun String.endsWith(ch: Char): Boolean {
|
||||
return if (s > 0) charAt(s - 1) == ch else false
|
||||
}
|
||||
|
||||
public inline fun String.startsWith(text: String): Boolean {
|
||||
val size = text.length
|
||||
return if (size <= this.length) {
|
||||
substring(0, size) == text
|
||||
} else false
|
||||
}
|
||||
native
|
||||
fun String.startsWith(s:String):Boolean = noImpl
|
||||
|
||||
public inline fun String.endsWith(text: String): Boolean {
|
||||
val matchSize = text.length
|
||||
val thisSize = this.length
|
||||
return if (matchSize <= thisSize) {
|
||||
substring(thisSize - matchSize, thisSize) == text
|
||||
} else false
|
||||
}
|
||||
native
|
||||
fun String.endsWith(s:String):Boolean = noImpl
|
||||
|
||||
native
|
||||
fun String.contains(s:String):Boolean = noImpl
|
||||
|
||||
/**
|
||||
* Returns a copy of this string capitalised if it is not empty or already starting with an uppper case letter, otherwise returns this
|
||||
|
||||
Reference in New Issue
Block a user