logo

final class

sys::StrBuf

sys::Obj
  sys::StrBuf

StrBuf is a mutable sequence of Int characters.

Slots

add

StrBuf add(Obj x)

Add x.toStr to the end of this buffer. If x is null then the string "null" is inserted. Return this.

Source

addChar

StrBuf addChar(Int ch)

Optimized implementation for add(ch.toChar). Return this.

Source

clear

StrBuf clear()

Clear the contents of the string buffer so that is has a size of zero. Return this.

Source

get

Int get(Int index)

Get the character at the zero based index as a Unicode code point. Negative indexes may be used to access from the end of the string buffer. This method is accessed via the [] operator.

Source

grow

StrBuf grow(Int size)

Ensure that this buffer has the specified capactity. If this buffer is already beyond the given capacity, then do nothing. Return this.

Source

insert

StrBuf insert(Int index, Obj x)

Insert x.toStr into this buffer at the specified index. If x is null then the string "null" is inserted. Negative indexes may be used to access from the end of the string buffer. Throw IndexErr if index is out of range. Return this.

Source

isEmpty

Bool isEmpty()

Return if size() == 0.

Source

make

new make(Int capacity := 16)

Create with initial capacity (defaults to 16).

Source

remove

StrBuf remove(Int index)

Remove the char at the specified index. A negative index may be used to access an index from the end of the list. Size is decremented by 1. Return the this. Throw IndexErr if index is out of range.

Source

set

StrBuf set(Int index, Int ch)

Replace the existing character at index in this buffer. Negative indexes may be used to access from the end of the string buffer. This method is accessed via the [] operator. Return this.

Source

size

Int size()

Return the number of characters in the buffer.

Source

toStr

override Str toStr()

Return the current buffer contents as a Str.

Source