Strings

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

- `Anything`
  - `Object`
    - `Basic` ...and other supertypes
      - `StringBuilder` ...and other supertypes

- `StringBuilder`
  - `Basic`
    - `Identifiable`
    - `Object`
      - `Anything`
  - `IndexedCorrespondenceMutator`
    - `CorrespondenceMutator`
  - `Ranged`
    - `Iterable`
      - `Category`
  - `SearchableList`
    - `List`
      - `Collection`
        - `Iterable`
          - `Category`
      - `Correspondence`
      - `Ranged`
        - `Iterable`
          - `Category`

no subtypes hierarchy

Initializer
`StringBuilder()`

Attributes
`empty` | Source Code `shared actual Boolean empty` Determines if the current content holds at least one character. Refines `Collection.empty` ultimately refines `Iterable.empty`
`hash` | Source Code `shared 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`. In general, `hash` values vary between platforms and between executions of the same program. Note that when executing on a Java Virtual Machine, the 64-bit `Integer` value returned by an implementation of `hash` is truncated to a 32-bit integer value by taking the exclusive disjunction of the 32 lowest-order bits with the 32 highest-order bits, before returning the value to the caller. Refines `Identifiable.hash` ultimately refines `Object.hash`
`lastIndex` | Source Code `shared 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`. Refines `List.lastIndex`
`size` | Source Code `shared actual Integer size` The number of characters in the current content, that is, the size of the produced `string`. Refines `List.size` ultimately refines `Iterable.size`
`string` | Source Code `shared actual variable String string` The resulting string. If no characters have been appended, the empty string. Refines `Iterable.string` ultimately refines `Object.string`

Inherited Attributes
Attributes inherited from: `Object` `hash`, `string`
Attributes inherited from: `Collection<Element>` `empty`, `permutations`, `string`
Attributes inherited from: `Correspondence<Key,Item>` `keys`
Attributes inherited from: `Iterable<Element,Absent>` `coalesced`, `cycled`, `distinct`, `empty`, `exceptLast`, `first`, `indexed`, `last`, `paired`, `rest`, `size`, `string`
Attributes inherited from: `List<Element>` `first`, `hash`, `keys`, `last`, `lastIndex`, `rest`, `reversed`, `size`

Methods
`append` | Source Code `shared StringBuilder append(String string)` Append the characters in the given `string`.
`appendAll` | Source Code `shared StringBuilder appendAll({String*} strings)` Append the characters in the given `strings`.
`appendCharacter` | Source Code `shared StringBuilder appendCharacter(Character character)` Append the given `character`.
`appendNewline` | Source Code `shared StringBuilder appendNewline()` Append a newline character.
`appendSpace` | Source Code `shared StringBuilder appendSpace()` Append a space character.
`clear` | Source Code `shared StringBuilder clear()` Remove all content and return to initial state. Since 1.1.0
`clone` | Source Code `shared actual StringBuilder clone()` A copy of this `StringBuilder`, whose content is initially the same as the current content of this instance. Since 1.3.0 Refines `List.clone` ultimately refines `Collection.clone`
`delete` | Source Code `shared 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.
`deleteInitial` | Source Code `shared StringBuilder deleteInitial(Integer length)` Deletes the specified number of characters from the start of the string. If `length` is nonpositive, nothing is deleted. Since 1.1.0
`deleteTerminal` | Source Code `shared StringBuilder deleteTerminal(Integer length)` Deletes the specified number of characters from the end of the string. If `length` is nonpositive, nothing is deleted. Since 1.1.0
`equals` | Source Code `shared actual Boolean equals(Object that)` Determine if two values are equal. For any two non-null objects `x` and `y`, `x.equals(y)` may be written as:
    x == y
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`. Note that an implementation of `equals()` that always returns `false` does satisfy the constraints given above. Therefore, in very rare cases where there is no reasonable definition of value equality for a class, for example, Return(*Arguments) , it is acceptable for `equals()` to be defined to return `false` for every argument. Refines `Identifiable.equals` ultimately refines `Object.equals`
`firstInclusion` | Source Code `shared 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 Code `shared actual Integer? firstOccurrence(Character character, Integer from, Integer length)` The first index at which the given `character` occurs, that is greater than or equal to the optional starting index. Refines `SearchableList.firstOccurrence`
`getFromFirst` | Source Code `shared actual Character? getFromFirst(Integer index)` The `index`th 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`
`includesAt` | Source Code `shared 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 Code `shared 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 Code `shared 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 `length<=0` return an empty list. For any `list`, and for any integer `length`:
    list.initial(length) == list[...length-1] == list[0:length]
This is an eager operation. Refines `List.initial`
`insert` | Source Code `shared StringBuilder insert(Integer index, String string)` Insert a `string` at the specified `index`.
`insertCharacter` | Source Code `shared StringBuilder insertCharacter(Integer index, Character character)` Insert a `character` at the specified `index`.
`iterator` | Source Code `shared actual Iterator<Character> iterator()` An iterator for the elements belonging to this stream. If this is a nonempty stream with type `{Element+}`, the iterator must produce at least one element. Refines `List.iterator` ultimately refines `Iterable.iterator`
`lastInclusion` | Source Code `shared 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 `0:size-from+1-sublist.size` defined by the optional starting index, interpreted as a reverse index counting from the end of the list. Refines `SearchableList.lastInclusion`
`lastOccurrence` | Source Code `shared actual Integer? lastOccurrence(Character character, Integer from, Integer length)` The last index at which the given `character` occurs, that falls within the range `0:size-from` defined by the optional starting index, interpreted as a reverse index counting from the end of the list. Refines `SearchableList.lastOccurrence`
`measure` | Source Code `shared actual String measure(Integer from, Integer length)` Obtain a measure containing the mapped values starting from the given starting index, with the given `length`. If `length<=0`, the resulting measure is empty. For any ranged stream `r`, `r.measure(from, length)` may be written using the measure operator:
    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 `Iterable.iterator()` of the stream. In the case where the iterator would be exhausted before `length` elements are produced, the resulting measure contains only those elements which were produced before the iterator was exhausted, and the length of the measure is less then the given `length`. When the given index does not belong to this ranged object, the behavior is implementation dependent. Refines `List.measure` ultimately refines `Ranged.measure`
`occurrences` | Source Code `shared 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 Code `shared 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 Code `shared StringBuilder prepend(String string)` Prepend the characters in the given `string`. Since 1.1.0
`prependAll` | Source Code `shared StringBuilder prependAll({String*} strings)` Prepend the characters in the given `strings`. Since 1.1.0
`prependCharacter` | Source Code `shared StringBuilder prependCharacter(Character character)` Prepend the given `character`. Since 1.1.0
`replace` | Source Code `shared 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, and the `string` is simply inserted at the specified `index`. Since 1.1.0
`reverseInPlace` | Source Code `shared StringBuilder reverseInPlace()` Reverses the order of the current characters. Since 1.1.0
`set` | Source Code `shared actual void set(Integer index, Character character)` Set the character at the given index to the given `character`. Since 1.3.0 Refines `IndexedCorrespondenceMutator.set`
`span` | Source Code `shared actual String span(Integer from, Integer to)` Obtain a span containing the elements between the two given indices. For any ranged stream `r`, `r.span(from, to)` may be written using the span operator:
    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 `Iterable.iterator()` of the stream, except when the ending index occurs earlier than the starting index, in which case they occur in the opposite order. When one or both of the given indices does not belong to this ranged stream, the behavior is implementation dependent. Refines `List.span` ultimately refines `Ranged.span`
`spanFrom` | Source Code `shared 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`, `r.spanFrom(from)` may be written using the span operator:
    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 `Iterable.iterator()` of the stream. When the given index does not belong to this ranged stream, the behavior is implementation dependent. Refines `List.spanFrom` ultimately refines `Ranged.spanFrom`
`spanTo` | Source Code `shared 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`, `r.spanTo(to)` may be written using the span operator:
    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 `Iterable.iterator()` of the stream. When the given index does not belong to this ranged stream, the behavior is implementation dependent. Refines `List.spanTo` ultimately refines `Ranged.spanTo`
`substring` | Source Code `shared String substring(Integer index, Integer length)` Deprecated: use `measure()` Returns a string of the given `length` containing the characters beginning at the given `index`. Since 1.1.0
`terminal` | Source Code `shared 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`, and for any integer `length`:
    list.terminal(length) == list[size-length...]
This is an eager operation. Refines `List.terminal`

Inherited Methods
Methods inherited from: `Object` `equals()`
Methods inherited from: `Category<Element>` `contains()`, `containsAny()`, `containsEvery()`
Methods inherited from: `Collection<Element>` `clone()`, `combinations()`, `contains()`
Methods inherited from: `Correspondence<Key,Item>` `defines()`, `definesAny()`, `definesEvery()`, `get()`, `getAll()`
Methods inherited from: `IndexedCorrespondenceMutator<Element>` `set()`
Methods inherited from: `Iterable<Element,Absent>` `any()`, `by()`, `chain()`, `collect()`, `contains()`, `count()`, `defaultNullElements()`, `each()`, `every()`, `filter()`, `find()`, `findLast()`, `flatMap()`, `fold()`, `follow()`, `frequencies()`, `getFromFirst()`, `group()`, `indexes()`, `interpose()`, `iterator()`, `locate()`, `locateLast()`, `locations()`, `longerThan()`, `map()`, `max()`, `narrow()`, `partition()`, `product()`, `reduce()`, `repeat()`, `scan()`, `select()`, `sequence()`, `shorterThan()`, `skip()`, `skipWhile()`, `sort()`, `spread()`, `summarize()`, `tabulate()`, `take()`, `takeWhile()`
Methods inherited from: `List<Element>` `clone()`, `collect()`, `contains()`, `defines()`, `endsWith()`, `equals()`, `find()`, `findLast()`, `firstIndexWhere()`, `get()`, `getFromFirst()`, `getFromLast()`, `indexesWhere()`, `initial()`, `iterator()`, `lastIndexWhere()`, `longerThan()`, `mapElements()`, `measure()`, `patch()`, `repeat()`, `shorterThan()`, `slice()`, `span()`, `spanFrom()`, `spanTo()`, `startsWith()`, `sublist()`, `sublistFrom()`, `sublistTo()`, `terminal()`, `trim()`, `trimLeading()`, `trimTrailing()`
Methods inherited from: `Ranged<Index,Element,Subrange>` `measure()`, `span()`, `spanFrom()`, `spanTo()`
Methods inherited from: `SearchableList<Element>` `firstInclusion()`, `firstOccurrence()`, `includes()`, `includesAt()`, `inclusions()`, `lastInclusion()`, `lastOccurrence()`, `occurrences()`, `occurs()`, `occursAt()`