Builder utility for constructing strings by incrementally appending strings or characters.

value builder = StringBuilder();
builder.appendCharacter(' ');
String hello = builder.string; //hello world

no subtypes hierarchy

hashSource Codeshared actual Integer hash

The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that:

  • if x==y then x.hash==y.hash.

Therefore, a class which refines Object.equals() must also refine hash.

Because the Integer type is platform-dependent a compiler for a given platform is permitted to further manipulate the calculated hash for an object, and the resulting hash may differ between platforms.

Refines List.hash ultimately refines Object.hash
lastIndexSource Codeshared actual Integer? lastIndex

The index of the last element of the list, or null if the list is empty. Always size>0 then size-1.

sizeSource Codeshared actual Integer size

The number characters in the current content, that is, the size of the produced string.

Refines List.size ultimately refines Iterable.size
stringSource Codeshared actual String string

The resulting string. If no characters have been appended, the empty string.

Refines Collection.string ultimately refines Object.string
Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: Collection<Element>
Attributes inherited from: Correspondence<Key,Item>
Attributes inherited from: Iterable<Element,Absent>
Attributes inherited from: List<Element>
appendSource Codeshared StringBuilder append(String string)

Append the characters in the given string.

appendAllSource Codeshared StringBuilder appendAll({String*} strings)

Append the characters in the given strings.

appendCharacterSource Codeshared StringBuilder appendCharacter(Character character)

Append the given character.

appendNewlineSource Codeshared StringBuilder appendNewline()

Append a newline character.

appendSpaceSource Codeshared StringBuilder appendSpace()

Append a space character.

clearSource Codeshared StringBuilder clear()

Remove all content and return to initial state.

deleteSource Codeshared StringBuilder delete(Integer index, Integer length)

Deletes the specified number of characters from the current content, starting at the specified index. If length is nonpositive, nothing is deleted.

deleteInitialSource Codeshared StringBuilder deleteInitial(Integer length)

Deletes the specified number of characters from the start of the string. If length is nonpositive, nothing is deleted.

deleteTerminalSource Codeshared StringBuilder deleteTerminal(Integer length)

Deletes the specified number of characters from the end of the string. If length is nonpositive, nothing is deleted.

equalsSource Codeshared actual Boolean equals(Object that)

Determine if two values are equal. Implementations should respect the constraints that:

  • if x===y then x==y (reflexivity),
  • if x==y then y==x (symmetry),
  • if x==y and y==z then x==z (transitivity).

Furthermore it is recommended that implementations ensure that if x==y then x and y have the same concrete class.

A class which explicitly refines equals() is said to support value equality, and the equality operator == is considered much more meaningful for such classes than for a class which simply inherits the default implementation of identity equality from Identifiable.

Refines List.equals ultimately refines Object.equals
getFromFirstSource Codeshared actual Character? getFromFirst(Integer index)

The indexth element returned by an iterator of this stream, or null if there are fewer than index+1 elements in the stream. For a stream with an unstable iteration order, a different value might be produced each time getFromFirst(index) is called for a given integer index.

Refines List.getFromFirst ultimately refines Iterable.getFromFirst
insertSource Codeshared StringBuilder insert(Integer index, String string)

Insert a string at the specified index.

insertCharacterSource Codeshared StringBuilder insertCharacter(Integer index, Character character)

Insert a character at the specified index.

iteratorSource Codeshared actual Iterator<Character> iterator()

An iterator for the elements belonging to this stream.

Refines List.iterator ultimately refines Iterable.iterator
prependSource Codeshared StringBuilder prepend(String string)

Prepend the characters in the given string.

prependAllSource Codeshared StringBuilder prependAll({String*} strings)

Prepend the characters in the given strings.

prependCharacterSource Codeshared StringBuilder prependCharacter(Character character)

Prepend the given character.

replaceSource Codeshared StringBuilder replace(Integer index, Integer length, String string)

Replaces the specified number of characters from the current content, starting at the specified index, with the given string. If length is nonpositive, nothing is replaced.

reverseInPlaceSource Codeshared StringBuilder reverseInPlace()

Reverses the order of the current characters.

substringSource Codeshared String substring(Integer index, Integer length)

Returns a string of the given length containing the characters beginning at the given index.

Inherited Methods
Methods inherited from: Object
Methods inherited from: Category<Element>
Methods inherited from: Collection<Element>
Methods inherited from: Correspondence<Key,Item>
Methods inherited from: Iterable<Element,Absent>
Methods inherited from: List<Element>
Methods inherited from: Ranged<Index,Element,Subrange>