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)
}Вывод
done
Appends one character.
Example:
fn main() io {
var s = String.new()
s.pushChar('x')
s.pushChar('y')
print(s.freeze())
}Вывод
xy
Appends a string.
Example:
fn main() io {
var s = String.new()
s.push("a")
s.push("bc")
print(s.freeze())
}Вывод
abc
Length in bytes (UTF-8).
Example:
fn main() io {
var s = String.new()
s.push("héllo")
print("{s.len()}")
}Вывод
6
An empty string builder.
Example:
fn main() io {
var s = String.new()
s.push("ab")
print(s.freeze())
}Вывод
ab
pub(api) init new() -> SelfС версии. 1.0.0-beta
Возвращает
Self
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/collections.oxl:1175