init String.new
Ends the building and returns the immutable str; the builder is consumed.
Example:
fn main() io {
var s = String.new()
s.push("done")
let text = s.freeze()
print(text)
}Output
done
Appends one character.
Example:
fn main() io {
var s = String.new()
s.pushChar('x')
s.pushChar('y')
print(s.freeze())
}Output
xy
Appends a string.
Example:
fn main() io {
var s = String.new()
s.push("a")
s.push("bc")
print(s.freeze())
}Output
abc
Length in bytes (UTF-8).
Example:
fn main() io {
var s = String.new()
s.push("héllo")
print("{s.len()}")
}Output
6
An empty string builder.
Example:
fn main() io {
var s = String.new()
s.push("ab")
print(s.freeze())
}Output
ab
pub(api) init new() -> SelfSince. 1.0.0-beta
Returns
Self
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/collections.oxl:1175