OxL Reference

data String

Mutable string buffer (§3.2); freeze() turns it into str.

Example:

oxl✓ checked in CI
fn main() io {
  var s = String.new()
  for i in 1..=3 {
    s.push("{i};")
  }
  print(s.freeze())
}
Output
1;2;3;
@builtin("String") pub(api) data String

Complexity. `push` is O(1) amortized.

Since. 1.0.0-beta

Methods

new() -> Self
Ends the building and returns the immutable str; the builder is consumed.
len() -> usize
The number of bytes built so far.
push(s: str)
Appends the text s.
pushChar(c: char)
Appends one character.
freeze() -> str
Ends the building and returns the immutable str; the builder is consumed.

Defined in: std/core/types.oxl:80

See also