append

Appends one UTF-16 code unit, growing the buffer if needed.

Return

this builder for chained calls.

Parameters

value

code unit to append.

Throws

if the resulting length would exceed Int.MAX_VALUE.


Copies all code units from value to the end of this builder.

Appending this builder to itself copies its original content once.

Return

this builder for chained calls.

Parameters

value

text to append; null appends the four characters null.

Throws

if the resulting length would exceed Int.MAX_VALUE.


fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder(source)

Copies a range of value to the end of this builder.

When value is null, the range selects from the four-character string null. Self-append reads the selected original range before changing length.

Return

this builder for chained calls.

Parameters

value

source text, or null to use null as the source.

startIndex

first source UTF-16 code unit to include.

endIndex

exclusive end of the source range; may equal startIndex.

Throws

if the range is reversed, is outside the source, or the resulting length would exceed Int.MAX_VALUE.


Copies all code units from value to the end of this builder.

Later changes to the array do not affect the appended text.

Return

this builder for chained calls.

Parameters

value

source array of UTF-16 code units.

Throws

if the resulting length would exceed Int.MAX_VALUE.


Converts value to text and appends that text.

A non-null value uses its toString() implementation; exceptions from that conversion propagate to the caller. Null appends the four characters null.

Return

this builder for chained calls.

Parameters

value

object to convert and append.

Throws

if the resulting length would exceed Int.MAX_VALUE.