W3cubDocs

/Kotlin

insertRange

Platform and version requirements: JVM (1.4)
fun StringBuilder.insertRange(
    index: Int, 
    value: CharArray, 
    startIndex: Int, 
    endIndex: Int
): StringBuilder

Inserts characters in a subarray of the specified character array value into this string builder at the specified index and returns this instance.

The inserted characters go in same order as in the value array, starting at index.

Parameters

index - the position in this string builder to insert at.

value - the array from which characters are inserted.

startIndex - the beginning (inclusive) of the subarray to insert.

endIndex - the end (exclusive) of the subarray to insert.

Exceptions

IndexOutOfBoundsException - or IllegalArgumentException when startIndex or endIndex is out of range of the value array indices or when startIndex > endIndex.

IndexOutOfBoundsException - if index is less than zero or greater than the length of this string builder.

Platform and version requirements: JVM (1.4)
fun StringBuilder.insertRange(
    index: Int, 
    value: CharSequence, 
    startIndex: Int, 
    endIndex: Int
): StringBuilder

Inserts characters in a subsequence of the specified character sequence value into this string builder at the specified index and returns this instance.

The inserted characters go in the same order as in the value character sequence, starting at index.

Parameters

index - the position in this string builder to insert at.

value - the character sequence from which a subsequence is inserted.

startIndex - the beginning (inclusive) of the subsequence to insert.

endIndex - the end (exclusive) of the subsequence to insert.

Exceptions

IndexOutOfBoundsException - or IllegalArgumentException when startIndex or endIndex is out of range of the value character sequence indices or when startIndex > endIndex.

IndexOutOfBoundsException - if index is less than zero or greater than the length of this string builder.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/java.lang.-string-builder/insert-range.html