StrBuf is a mutable sequence of Int characters.
Slots
- addSource
-
Add x.toStr to the end of this buffer. If x is null then the string "null" is inserted. Return this.
- addCharSource
-
Optimized implementation for add(ch.toChar). Return this.
- capacitySource
-
Int capacity
The number of characters this buffer can hold without allocating more memory.
- clearSource
-
This clear()
Clear the contents of the string buffer so that is has a size of zero. Return this.
- getSource
-
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.
- insertSource
-
This 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.
- isEmptySource
-
Bool isEmpty()
Return if size() == 0.
- joinSource
-
This join(Obj? x, Str sep := " ")
Add x.toStr to the end of the buffer. If the buffer is not empty, then first add the specified separator which defaults to a space if not specified. Return this.
- makeSource
-
new make(Int capacity := 16)
Create with initial capacity (defaults to 16).
- outSource
-
OutStream out()
Create an output stream to append characters to this string buffer. The output stream is designed to write character data, attempts to do binary writes will throw UnsupportedErr.
- removeSource
-
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.
- removeRangeSource
-
Remove a range of indices from this buffer. Negative indexes may be used to access from the end of the list. Throw IndexErr if range illegal. Return this.
- setSource
-
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.
- sizeSource
-
Int size()
Return the number of characters in the buffer.
- toStrSource
-
override Str toStr()
Overrides sys::Obj.toStr
Return the current buffer contents as a Str.