Promote Regex.matchAt and matchesAt to Stable #KT-51470
This commit is contained in:
@@ -1415,16 +1415,16 @@ public final class Regex {
|
|||||||
|
|
||||||
public final fun findAll(input: kotlin.CharSequence, startIndex: kotlin.Int = ...): kotlin.sequences.Sequence<kotlin.text.MatchResult>
|
public final fun findAll(input: kotlin.CharSequence, startIndex: kotlin.Int = ...): kotlin.sequences.Sequence<kotlin.text.MatchResult>
|
||||||
|
|
||||||
@kotlin.SinceKotlin(version = "1.5")
|
@kotlin.SinceKotlin(version = "1.7")
|
||||||
@kotlin.ExperimentalStdlibApi
|
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalStdlibApi::class})
|
||||||
public final fun matchAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.text.MatchResult?
|
public final fun matchAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.text.MatchResult?
|
||||||
|
|
||||||
public final fun matchEntire(input: kotlin.CharSequence): kotlin.text.MatchResult?
|
public final fun matchEntire(input: kotlin.CharSequence): kotlin.text.MatchResult?
|
||||||
|
|
||||||
public final infix fun matches(input: kotlin.CharSequence): kotlin.Boolean
|
public final infix fun matches(input: kotlin.CharSequence): kotlin.Boolean
|
||||||
|
|
||||||
@kotlin.SinceKotlin(version = "1.5")
|
@kotlin.SinceKotlin(version = "1.7")
|
||||||
@kotlin.ExperimentalStdlibApi
|
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalStdlibApi::class})
|
||||||
public final fun matchesAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.Boolean
|
public final fun matchesAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.Boolean
|
||||||
|
|
||||||
public final fun replace(input: kotlin.CharSequence, transform: (kotlin.text.MatchResult) -> kotlin.CharSequence): kotlin.String
|
public final fun replace(input: kotlin.CharSequence, transform: (kotlin.text.MatchResult) -> kotlin.CharSequence): kotlin.String
|
||||||
|
|||||||
@@ -1415,16 +1415,16 @@ public final class Regex {
|
|||||||
|
|
||||||
public final fun findAll(input: kotlin.CharSequence, startIndex: kotlin.Int = ...): kotlin.sequences.Sequence<kotlin.text.MatchResult>
|
public final fun findAll(input: kotlin.CharSequence, startIndex: kotlin.Int = ...): kotlin.sequences.Sequence<kotlin.text.MatchResult>
|
||||||
|
|
||||||
@kotlin.SinceKotlin(version = "1.5")
|
@kotlin.SinceKotlin(version = "1.7")
|
||||||
@kotlin.ExperimentalStdlibApi
|
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalStdlibApi::class})
|
||||||
public final fun matchAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.text.MatchResult?
|
public final fun matchAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.text.MatchResult?
|
||||||
|
|
||||||
public final fun matchEntire(input: kotlin.CharSequence): kotlin.text.MatchResult?
|
public final fun matchEntire(input: kotlin.CharSequence): kotlin.text.MatchResult?
|
||||||
|
|
||||||
public final infix fun matches(input: kotlin.CharSequence): kotlin.Boolean
|
public final infix fun matches(input: kotlin.CharSequence): kotlin.Boolean
|
||||||
|
|
||||||
@kotlin.SinceKotlin(version = "1.5")
|
@kotlin.SinceKotlin(version = "1.7")
|
||||||
@kotlin.ExperimentalStdlibApi
|
@kotlin.WasExperimental(markerClass = {kotlin.ExperimentalStdlibApi::class})
|
||||||
public final fun matchesAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.Boolean
|
public final fun matchesAt(input: kotlin.CharSequence, index: kotlin.Int): kotlin.Boolean
|
||||||
|
|
||||||
public final fun replace(input: kotlin.CharSequence, transform: (kotlin.text.MatchResult) -> kotlin.CharSequence): kotlin.String
|
public final fun replace(input: kotlin.CharSequence, transform: (kotlin.text.MatchResult) -> kotlin.CharSequence): kotlin.String
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ expect class Regex {
|
|||||||
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of the [input] char sequence.
|
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of the [input] char sequence.
|
||||||
* @sample samples.text.Regexps.matchAt
|
* @sample samples.text.Regexps.matchAt
|
||||||
*/
|
*/
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
fun matchAt(input: CharSequence, index: Int): MatchResult?
|
fun matchAt(input: CharSequence, index: Int): MatchResult?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,8 +38,8 @@ expect class Regex {
|
|||||||
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of the [input] char sequence.
|
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of the [input] char sequence.
|
||||||
* @sample samples.text.Regexps.matchesAt
|
* @sample samples.text.Regexps.matchesAt
|
||||||
*/
|
*/
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
fun matchesAt(input: CharSequence, index: Int): Boolean
|
fun matchesAt(input: CharSequence, index: Int): Boolean
|
||||||
|
|
||||||
fun containsMatchIn(input: CharSequence): Boolean
|
fun containsMatchIn(input: CharSequence): Boolean
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ public actual class Regex actual constructor(pattern: String, options: Set<Regex
|
|||||||
return nativePattern.test(input.toString())
|
return nativePattern.test(input.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
public actual fun matchesAt(input: CharSequence, index: Int): Boolean {
|
public actual fun matchesAt(input: CharSequence, index: Int): Boolean {
|
||||||
if (index < 0 || index > input.length) {
|
if (index < 0 || index > input.length) {
|
||||||
throw IndexOutOfBoundsException("index out of bounds: $index, input length: ${input.length}")
|
throw IndexOutOfBoundsException("index out of bounds: $index, input length: ${input.length}")
|
||||||
@@ -152,8 +152,8 @@ public actual class Regex actual constructor(pattern: String, options: Set<Regex
|
|||||||
public actual fun matchEntire(input: CharSequence): MatchResult? =
|
public actual fun matchEntire(input: CharSequence): MatchResult? =
|
||||||
initMatchesEntirePattern().findNext(input.toString(), 0, nativePattern)
|
initMatchesEntirePattern().findNext(input.toString(), 0, nativePattern)
|
||||||
|
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
public actual fun matchAt(input: CharSequence, index: Int): MatchResult? {
|
public actual fun matchAt(input: CharSequence, index: Int): MatchResult? {
|
||||||
if (index < 0 || index > input.length) {
|
if (index < 0 || index > input.length) {
|
||||||
throw IndexOutOfBoundsException("index out of bounds: $index, input length: ${input.length}")
|
throw IndexOutOfBoundsException("index out of bounds: $index, input length: ${input.length}")
|
||||||
|
|||||||
@@ -143,15 +143,15 @@ internal constructor(private val nativePattern: Pattern) : Serializable {
|
|||||||
*/
|
*/
|
||||||
public actual fun matchEntire(input: CharSequence): MatchResult? = nativePattern.matcher(input).matchEntire(input)
|
public actual fun matchEntire(input: CharSequence): MatchResult? = nativePattern.matcher(input).matchEntire(input)
|
||||||
|
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
public actual fun matchAt(input: CharSequence, index: Int): MatchResult? =
|
public actual fun matchAt(input: CharSequence, index: Int): MatchResult? =
|
||||||
nativePattern.matcher(input).useAnchoringBounds(false).useTransparentBounds(true).region(index, input.length).run {
|
nativePattern.matcher(input).useAnchoringBounds(false).useTransparentBounds(true).region(index, input.length).run {
|
||||||
if (lookingAt()) MatcherMatchResult(this, input) else null
|
if (lookingAt()) MatcherMatchResult(this, input) else null
|
||||||
}
|
}
|
||||||
|
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
public actual fun matchesAt(input: CharSequence, index: Int): Boolean =
|
public actual fun matchesAt(input: CharSequence, index: Int): Boolean =
|
||||||
nativePattern.matcher(input).useAnchoringBounds(false).useTransparentBounds(true).region(index, input.length).lookingAt()
|
nativePattern.matcher(input).useAnchoringBounds(false).useTransparentBounds(true).region(index, input.length).lookingAt()
|
||||||
|
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ public actual class Regex internal constructor(internal val nativePattern: Patte
|
|||||||
/** Indicates whether the regular expression can find at least one match in the specified [input]. */
|
/** Indicates whether the regular expression can find at least one match in the specified [input]. */
|
||||||
actual fun containsMatchIn(input: CharSequence): Boolean = find(input) != null
|
actual fun containsMatchIn(input: CharSequence): Boolean = find(input) != null
|
||||||
|
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
public actual fun matchesAt(input: CharSequence, index: Int): Boolean =
|
public actual fun matchesAt(input: CharSequence, index: Int): Boolean =
|
||||||
// TODO: expand and simplify
|
// TODO: expand and simplify
|
||||||
matchAt(input, index) != null
|
matchAt(input, index) != null
|
||||||
@@ -221,8 +221,8 @@ public actual class Regex internal constructor(internal val nativePattern: Patte
|
|||||||
*/
|
*/
|
||||||
actual fun matchEntire(input: CharSequence): MatchResult?= doMatch(input, Mode.MATCH)
|
actual fun matchEntire(input: CharSequence): MatchResult?= doMatch(input, Mode.MATCH)
|
||||||
|
|
||||||
@SinceKotlin("1.5")
|
@SinceKotlin("1.7")
|
||||||
@ExperimentalStdlibApi
|
@WasExperimental(ExperimentalStdlibApi::class)
|
||||||
public actual fun matchAt(input: CharSequence, index: Int): MatchResult? {
|
public actual fun matchAt(input: CharSequence, index: Int): MatchResult? {
|
||||||
if (index < 0 || index > input.length) {
|
if (index < 0 || index > input.length) {
|
||||||
throw IndexOutOfBoundsException("index is out of bounds: $index, input length: ${input.length}")
|
throw IndexOutOfBoundsException("index is out of bounds: $index, input length: ${input.length}")
|
||||||
|
|||||||
Reference in New Issue
Block a user