js.stdlib: native replace made private.

This commit is contained in:
Ilya Gorbunov
2015-04-06 22:11:32 +03:00
parent 69a5d27c74
commit 370a67e753
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -50,6 +50,16 @@ public val CharSequence.size: Int get() = noImpl
library
public fun CharSequence.isEmpty(): Boolean = noImpl
// native because we need to escape newValue
native("replace")
private fun String.nativeReplace(oldValue: String, newValue: String): String = noImpl
native("replace")
private fun String.nativeReplace(pattern: RegExp, replacement: String): String = noImpl
/*
native public fun String.equalsIgnoreCase(anotherString: String) : Boolean = (this as java.lang.String).equalsIgnoreCase(anotherString)
+4
View File
@@ -78,3 +78,7 @@ public inline fun String.capitalize(): String {
public inline fun String.decapitalize(): String {
return if (isNotEmpty()) substring(0, 1).toLowerCase() + substring(1) else this
}
public fun String.replace(oldValue: String, newValue: String): String = nativeReplace(oldValue, newValue.nativeReplace("$", "$$"))