insert

Common
JS
1.3
@ExperimentalStdlibApi fun insert(
    index: Int,
    value: Boolean
): StringBuilder
Native
1.3
fun insert(index: Int, value: Boolean): StringBuilder

Inserts the string representation of the specified boolean value into this string builder at the specified index and returns this instance.

The overall effect is exactly as if the value were converted to a string by the value.toString() method, and then that string was inserted into this string builder at the specified index.

Exceptions

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

Common
JS
1.3
@ExperimentalStdlibApi fun insert(
    index: Int,
    value: Char
): StringBuilder
Native
1.3
fun insert(index: Int, value: Char): StringBuilder

Inserts the specified character value into this string builder at the specified index and returns this instance.

Exceptions

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

Common
JS
1.3
@ExperimentalStdlibApi fun insert(
    index: Int,
    value: CharArray
): StringBuilder
Native
1.3
fun insert(index: Int, value: CharArray): StringBuilder

Inserts characters in 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 character array, starting at index.

Exceptions

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

Common
JS
1.3
@ExperimentalStdlibApi fun insert(
    index: Int,
    value: CharSequence?
): StringBuilder
Native
1.3
fun insert(index: Int, value: CharSequence?): StringBuilder

Inserts characters in 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 characters are inserted. If value is null, then the four characters "null" are inserted.

Exceptions

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

Common
JS
1.3
@ExperimentalStdlibApi fun insert(
    index: Int,
    value: Any?
): StringBuilder
Native
1.3
fun insert(index: Int, value: Any?): StringBuilder

Inserts the string representation of the specified object value into this string builder at the specified index and returns this instance.

The overall effect is exactly as if the value were converted to a string by the value.toString() method, and then that string was inserted into this string builder at the specified index.

Exceptions

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

Common
JS
1.3
@ExperimentalStdlibApi fun insert(
    index: Int,
    value: String
): StringBuilder
Native
1.3
fun insert(index: Int, value: String): StringBuilder

Inserts the string value into this string builder at the specified index and returns this instance.

Exceptions

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

Native
1.3
fun insert(index: Int, value: Byte): StringBuilder
fun insert(index: Int, value: Short): StringBuilder
fun insert(index: Int, value: Int): StringBuilder
fun insert(index: Int, value: Long): StringBuilder
fun insert(index: Int, value: Float): StringBuilder
fun insert(index: Int, value: Double): StringBuilder