data String
Mutable string buffer (§3.2); freeze() turns it into str.
Example:
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 StringComplexity. `push` is O(1) amortized.
Since. 1.0.0-beta
Methods
new | () -> SelfEnds the building and returns the immutable str; the builder is consumed. |
len | () -> usizeThe number of bytes built so far. |
push | (s: str)Appends the text s. |
pushChar | (c: char)Appends one character. |
freeze | () -> strEnds the building and returns the immutable str; the builder is consumed. |
Defined in: std/core/types.oxl:80