Deprecate JS String match, matches and concat functions

This commit is contained in:
Abduqodiri Qurbonzoda
2021-09-01 11:17:00 +03:00
committed by Space
parent 3fefed5131
commit 921af8e98c
4 changed files with 19 additions and 1 deletions
@@ -141,6 +141,8 @@ public fun kotlin.CharSequence.commonSuffixWith(other: kotlin.CharSequence, igno
@kotlin.SinceKotlin(version = "1.2")
public fun kotlin.String.compareTo(other: kotlin.String, ignoreCase: kotlin.Boolean = ...): kotlin.Int
@kotlin.Deprecated(message = "Use String.plus() instead", replaceWith = kotlin.ReplaceWith(expression = "this + str", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.6")
@kotlin.internal.InlineOnly
public inline fun kotlin.String.concat(str: kotlin.String): kotlin.String
@@ -476,12 +478,16 @@ public inline fun <R : kotlin.Any, C : kotlin.collections.MutableCollection<in R
public inline fun <R, C : kotlin.collections.MutableCollection<in R>> kotlin.CharSequence.mapTo(destination: C, transform: (kotlin.Char) -> R): C
@kotlin.Deprecated(message = "Use Regex.findAll() instead or invoke matches() on String dynamically: this.asDynamic().match(regex)")
@kotlin.DeprecatedSinceKotlin(warningSince = "1.6")
@kotlin.internal.InlineOnly
public inline fun kotlin.String.match(regex: kotlin.String): kotlin.Array<kotlin.String>?
@kotlin.internal.InlineOnly
public inline infix fun kotlin.CharSequence.matches(regex: kotlin.text.Regex): kotlin.Boolean
@kotlin.Deprecated(message = "Use Regex.matches() instead", replaceWith = kotlin.ReplaceWith(expression = "regex.toRegex().matches(this)", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.6")
public fun kotlin.String.matches(regex: kotlin.String): kotlin.Boolean
@kotlin.Deprecated(message = "Use maxOrNull instead.", replaceWith = kotlin.ReplaceWith(expression = "this.maxOrNull()", imports = {}))
+6
View File
@@ -141,6 +141,8 @@ public fun kotlin.CharSequence.commonSuffixWith(other: kotlin.CharSequence, igno
@kotlin.SinceKotlin(version = "1.2")
public fun kotlin.String.compareTo(other: kotlin.String, ignoreCase: kotlin.Boolean = ...): kotlin.Int
@kotlin.Deprecated(message = "Use String.plus() instead", replaceWith = kotlin.ReplaceWith(expression = "this + str", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.6")
@kotlin.internal.InlineOnly
public inline fun kotlin.String.concat(str: kotlin.String): kotlin.String
@@ -476,12 +478,16 @@ public inline fun <R : kotlin.Any, C : kotlin.collections.MutableCollection<in R
public inline fun <R, C : kotlin.collections.MutableCollection<in R>> kotlin.CharSequence.mapTo(destination: C, transform: (kotlin.Char) -> R): C
@kotlin.Deprecated(message = "Use Regex.findAll() instead or invoke matches() on String dynamically: this.asDynamic().match(regex)")
@kotlin.DeprecatedSinceKotlin(warningSince = "1.6")
@kotlin.internal.InlineOnly
public inline fun kotlin.String.match(regex: kotlin.String): kotlin.Array<kotlin.String>?
@kotlin.internal.InlineOnly
public inline infix fun kotlin.CharSequence.matches(regex: kotlin.text.Regex): kotlin.Boolean
@kotlin.Deprecated(message = "Use Regex.matches() instead", replaceWith = kotlin.ReplaceWith(expression = "regex.toRegex().matches(this)", imports = {}))
@kotlin.DeprecatedSinceKotlin(warningSince = "1.6")
public fun kotlin.String.matches(regex: kotlin.String): kotlin.Boolean
@kotlin.Deprecated(message = "Use maxOrNull instead.", replaceWith = kotlin.ReplaceWith(expression = "this.maxOrNull()", imports = {}))
@@ -228,9 +228,13 @@ public actual inline fun String.substring(startIndex: Int): String = asDynamic()
@kotlin.internal.InlineOnly
public actual inline fun String.substring(startIndex: Int, endIndex: Int): String = asDynamic().substring(startIndex, endIndex)
@Deprecated("Use String.plus() instead", ReplaceWith("this + str"))
@DeprecatedSinceKotlin(warningSince = "1.6")
@kotlin.internal.InlineOnly
public inline fun String.concat(str: String): String = asDynamic().concat(str)
@Deprecated("Use Regex.findAll() instead or invoke matches() on String dynamically: this.asDynamic().match(regex)")
@DeprecatedSinceKotlin(warningSince = "1.6")
@kotlin.internal.InlineOnly
public inline fun String.match(regex: String): Array<String>? = asDynamic().match(regex)
@@ -46,8 +46,10 @@ public actual fun String.endsWith(suffix: String, ignoreCase: Boolean = false):
return regionMatches(length - suffix.length, suffix, 0, suffix.length, ignoreCase)
}
@Deprecated("Use Regex.matches() instead", ReplaceWith("regex.toRegex().matches(this)"))
@DeprecatedSinceKotlin(warningSince = "1.6")
public fun String.matches(regex: String): Boolean {
@Suppress("DEPRECATION")
val result = this.match(regex)
return result != null && result.size != 0
}