W3cubDocs

/Kotlin

replaceRange

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun CharSequence.replaceRange(
    startIndex: Int, 
    endIndex: Int, 
    replacement: CharSequence
): CharSequence

Returns a char sequence with content of this char sequence where its part at the given range is replaced with the replacement char sequence.

Parameters

startIndex - the index of the first character to be replaced.

endIndex - the index of the first character after the replacement to keep in the string.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun String.replaceRange(
    startIndex: Int, 
    endIndex: Int, 
    replacement: CharSequence
): String

Replaces the part of the string at the given range with the replacement char sequence.

Parameters

startIndex - the index of the first character to be replaced.

endIndex - the index of the first character after the replacement to keep in the string.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun CharSequence.replaceRange(
    range: IntRange, 
    replacement: CharSequence
): CharSequence

Returns a char sequence with content of this char sequence where its part at the given range is replaced with the replacement char sequence.

The end index of the range is included in the part to be replaced.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun String.replaceRange(
    range: IntRange, 
    replacement: CharSequence
): String

Replace the part of string at the given range with the replacement string.

The end index of the range is included in the part to be replaced.

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/replace-range.html