logo

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.

addChar

StrBuf addChar(Int ch)

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

clear

StrBuf clear()

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

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.

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.

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.

isEmpty

Bool isEmpty()

Return if size() == 0.

make

new make(Int capacity := def)

Create with initial capacity (defaults to 16).

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.

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.

size

Int size()

Return the number of characters in the buffer.

toStr

override Str toStr()

Return the current buffer contents as a Str.