Builder utility for constructing strings by incrementally appending strings or characters.
value builder = StringBuilder(); builder.append("hello"); builder.appendCharacter(' '); builder.append("world"); String hello = builder.string; //hello world
no subtypes hierarchy
Initializer |
StringBuilder() |
Attributes | |
empty | Source Codeshared actual Boolean empty Determines if the current content holds at least one character. |
hash | Source 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:
Therefore, a class which refines In general, Note that when executing on a Java Virtual Machine, the
64-bit |
lastIndex | Source Codeshared actual Integer? lastIndex The index of the last element of the list, or Refines List.lastIndex |
size | Source Codeshared actual Integer size |
string | Source Codeshared actual variable String string The resulting string. If no characters have been appended, the empty 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> |
Methods | |
append | Source Codeshared StringBuilder append(String string) Append the characters in the given |
appendAll | Source Codeshared StringBuilder appendAll({String*} strings) Append the characters in the given |
appendCharacter | Source Codeshared StringBuilder appendCharacter(Character character) Append the given |
appendNewline | Source Codeshared StringBuilder appendNewline() Append a newline character. |
appendSpace | Source Codeshared StringBuilder appendSpace() Append a space character. |
clear | Source Codeshared StringBuilder clear() Remove all content and return to initial state. Since 1.1.0 |
clone | Source Codeshared actual StringBuilder clone() A copy of this Since 1.3.0 |
delete | Source Codeshared StringBuilder delete(Integer index, Integer length) Deletes the specified number of characters
from the current content, starting at the specified
|
deleteInitial | Source Codeshared StringBuilder deleteInitial(Integer length) Deletes the specified number of characters
from the start of the string. If Since 1.1.0 |
deleteTerminal | Source Codeshared StringBuilder deleteTerminal(Integer length) Deletes the specified number of characters
from the end of the string. If Since 1.1.0 |
equals | Source Codeshared actual Boolean equals(Object that) Determine if two values are equal. For any two non-null objects x == y Implementations should respect the constraints that:
Furthermore it is recommended that implementations
ensure that if A class which explicitly refines Note that an implementation of |
firstInclusion | Source Codeshared actual Integer? firstInclusion(List<Character> sublist, Integer from) The first index at which the given list of characters occurs as a sublist, that is greater than or equal to the optional starting index. Refines SearchableList.firstInclusion |
firstOccurrence | Source Codeshared actual Integer? firstOccurrence(Character character, Integer from, Integer length) The first index at which the given Refines SearchableList.firstOccurrence |
getFromFirst | Source Codeshared actual Character? getFromFirst(Integer index) The |
includesAt | Source Codeshared actual Boolean includesAt(Integer index, List<Character> sublist) Determine if the given list occurs as a sublist at the given index of this list. Refines SearchableList.includesAt |
inclusions | Source Codeshared actual {Integer*} inclusions(List<Character> sublist, Integer from) The indexes in this list at which the given list occurs as a sublist, that are greater than or equal to the optional starting index. Refines SearchableList.inclusions |
initial | Source Codeshared actual String initial(Integer length) Select the first elements of this list, returning a
list no longer than the given length. If this list is
shorter than the given length, return this list.
Otherwise return a list of the given length. If
For any list.initial(length) == list[...length-1] == list[0:length] This is an eager operation. Refines List.initial |
insert | Source Codeshared StringBuilder insert(Integer index, String string) |
insertCharacter | Source Codeshared StringBuilder insertCharacter(Integer index, Character character) |
iterator | Source Codeshared actual Iterator<Character> iterator() An iterator for the elements belonging to this stream. If this is a nonempty stream with type |
lastInclusion | Source Codeshared actual Integer? lastInclusion(List<Character> sublist, Integer from) The last index at which the given
list of characters occurs as a sublist,
that falls within the range Refines SearchableList.lastInclusion |
lastOccurrence | Source Codeshared actual Integer? lastOccurrence(Character character, Integer from, Integer length) The last index at which the given Refines SearchableList.lastOccurrence |
measure | Source Codeshared actual String measure(Integer from, Integer length) Obtain a measure containing the mapped values starting
from the given starting index, with the given
For any ranged stream r[from:length] The measure should contain the given number
of elements of this stream, starting from the element
at the given starting index, in the same order
as they are produced by the When the given index does not belong to this ranged object, the behavior is implementation dependent. |
occurrences | Source Codeshared actual {Integer*} occurrences(Character character, Integer from, Integer length) The indexes in this list at which the given value occurs. Refines SearchableList.occurrences |
occursAt | Source Codeshared actual Boolean occursAt(Integer index, Character character) Determines if the given value occurs at the given index in this list. Refines SearchableList.occursAt |
prepend | Source Codeshared StringBuilder prepend(String string) Prepend the characters in the given Since 1.1.0 |
prependAll | Source Codeshared StringBuilder prependAll({String*} strings) Prepend the characters in the given Since 1.1.0 |
prependCharacter | Source Codeshared StringBuilder prependCharacter(Character character) Prepend the given Since 1.1.0 |
replace | Source Codeshared StringBuilder replace(Integer index, Integer length, String string) Replaces the specified number of characters
from the current content, starting at the specified
Since 1.1.0 |
reverseInPlace | Source Codeshared StringBuilder reverseInPlace() Reverses the order of the current characters. Since 1.1.0 |
set | Source Codeshared actual void set(Integer index, Character character) Set the character at the given index to the given
Since 1.3.0 Refines IndexedCorrespondenceMutator.set |
span | Source Codeshared actual String span(Integer from, Integer to) Obtain a span containing the elements between the two given indices. For any ranged stream r[from..to] The span should contain elements of this stream,
starting from the element at the given starting
index, and ending with the element at the given
ending index, in the same order as they are
produced by the When one or both of the given indices does not belong to this ranged stream, the behavior is implementation dependent. |
spanFrom | Source Codeshared actual String spanFrom(Integer from) Obtain a span containing the elements between the given starting index and the last index of this ranged object. For any ranged stream r[from...] The span should contain elements of this stream,
starting from the element at the given starting
index, in the same order as they are produced by
the When the given index does not belong to this ranged stream, the behavior is implementation dependent. |
spanTo | Source Codeshared actual String spanTo(Integer to) Obtain a span containing the elements between the first index of this ranged stream and given end index. For any ranged stream r[...to] The span should contain elements of this stream, up to
the element at the given ending index, in the
same order as they are produced by the When the given index does not belong to this ranged stream, the behavior is implementation dependent. |
substring | Source Codeshared String substring(Integer index, Integer length) |
terminal | Source Codeshared actual String terminal(Integer length) Select the last elements of the list, returning a list no longer than the given length. If this list is shorter than the given length, return this list. Otherwise return a list of the given length. For any list.terminal(length) == list[size-length...] This is an eager operation. Refines List.terminal |