Home / Docs / Standard library / Prelude
trim_start
Release v0.4.0Edition 0.2 and later
A function of the prelude, in scope in every module. Edition 0.2 and later.
una
pub trim_start(t: Text) -> Text
ensures result.len <= t.lent without Unicode white space at its start (spec/22 §2).
Parameters
t: the text
Returns
Text: t without the Unicode White_Space at its start; never longer than t.
See also
Cost
Time O(result + trimmed) (ADR 0070), where:
result: the length of the result in UTF-8 bytestrimmed: the length in UTF-8 bytes of the white space removed
Example
src/shop.una
module shop
--- An article number typed with spaces before it.
pub main() -> Unit
uses @console: Console[print]
=
let number = " 0042 ".trim_start()
@console.print("[{number}]")una run . prints:
Output
[0042 ]Specification
Generated from the standard modules of una v0.4.0 (docs/std/listing.json, which is not part of the specification). The specification governs: spec/14 §1.