Home / Docs / Standard library / Prelude
to_lower
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 to_lower(t: Text) -> Text
ensures result.len == t.lent with the ASCII letters A to Z in lower case (spec/22 §3).
Parameters
t: the text
Returns
Text: t with the ASCII letters A to Z in lower case and every other scalar value as it is; the same length as t.
See also
Cost
Time O(b) (ADR 0070), where:
b: the length oftin UTF-8 bytes
Example
src/shop.una
module shop
--- An SKU as part of a web address.
pub main() -> Unit
uses @console: Console[print]
=
let slug = "LAMP-01".to_lower()
@console.print("/products/{slug}")una run . prints:
Output
/products/lamp-01Specification
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.