insert

expect fun StringBuilder.insert(index: Int, value: Byte): StringBuilder(source)

Inserts the string representation of the specified byte 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.

Since Kotlin

1.9

Throws

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


expect fun StringBuilder.insert(index: Int, value: Short): StringBuilder(source)

Inserts the string representation of the specified short 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.

Since Kotlin

1.9

Throws

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

actual inline fun StringBuilder.insert(index: Int, value: Byte): StringBuilder(source)

Inserts the string representation of the specified byte 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.

Since Kotlin

1.9

Throws

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


actual inline fun StringBuilder.insert(index: Int, value: Short): StringBuilder(source)

Inserts the string representation of the specified short 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.

Since Kotlin

1.9

Throws

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

actual inline fun StringBuilder.insert(index: Int, value: Byte): StringBuilder(source)

Inserts the string representation of the specified byte 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.

Since Kotlin

1.9

Throws

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


actual inline fun StringBuilder.insert(index: Int, value: Short): StringBuilder(source)

Inserts the string representation of the specified short 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.

Since Kotlin

1.9

Throws

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


inline fun StringBuilder.insert(index: Int, csq: CharSequence?, start: Int, end: Int): StringBuilder(source)

Deprecated

Warning since 1.4

Error since 1.6

Use insertRange(index: Int, csq: CharSequence, start: Int, end: Int) instead

Replace with

insertRange(index, csq ?: "null", start, end)

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

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

Since Kotlin

1.3

Parameters

index

the position in this string builder to insert at.

csq

the character sequence from which a subsequence is inserted. If csq is null, then characters will be inserted as if csq contained the four characters "null".

start

the beginning (inclusive) of the subsequence to insert.

end

the end (exclusive) of the subsequence to insert.

Throws

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

actual inline fun StringBuilder.insert(index: Int, value: Byte): StringBuilder(source)

Inserts the string representation of the specified byte 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.

Since Kotlin

1.9

Throws

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


actual inline fun StringBuilder.insert(index: Int, value: Short): StringBuilder(source)

Inserts the string representation of the specified short 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.

Since Kotlin

1.9

Throws

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


inline fun StringBuilder.insert(index: Int, csq: CharSequence?, start: Int, end: Int): StringBuilder(source)

Deprecated

Warning since 1.4

Error since 1.6

Use insertRange(index: Int, csq: CharSequence, start: Int, end: Int) instead

Replace with

insertRange(index, csq ?: "null", start, end)

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

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

Since Kotlin

1.8

Parameters

index

the position in this string builder to insert at.

csq

the character sequence from which a subsequence is inserted. If csq is null, then characters will be inserted as if csq contained the four characters "null".

start

the beginning (inclusive) of the subsequence to insert.

end

the end (exclusive) of the subsequence to insert.

Throws

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

actual inline fun StringBuilder.insert(index: Int, value: Byte): StringBuilder(source)

Inserts the string representation of the specified byte 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.

Since Kotlin

1.9

Throws

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


actual inline fun StringBuilder.insert(index: Int, value: Short): StringBuilder(source)

Inserts the string representation of the specified short 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.

Since Kotlin

1.9

Throws

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


inline fun StringBuilder.insert(index: Int, csq: CharSequence?, start: Int, end: Int): StringBuilder(source)

Deprecated

Warning since 1.4

Error since 1.6

Use insertRange(index: Int, csq: CharSequence, start: Int, end: Int) instead

Replace with

insertRange(index, csq ?: "null", start, end)

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

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

Since Kotlin

1.8

Parameters

index

the position in this string builder to insert at.

csq

the character sequence from which a subsequence is inserted. If csq is null, then characters will be inserted as if csq contained the four characters "null".

start

the beginning (inclusive) of the subsequence to insert.

end

the end (exclusive) of the subsequence to insert.

Throws

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