Skip to content

std::text - Text functions

func concat

func concat(left: text, right: text): text

Concatenates two text values.

func length

func length(text): uint32

Returns the number of characters in a text value.

func from_ascii

func from_ascii(uint8): text

Converts ASCII code to its corresponding Unicode character. This function always succeeds, because ASCII is a subset of Unicode.

func join

func join(parts: [text], separator: text): text

Joins parts together, placing separator between each pair.

func split

func split(value: text, separator: text): [text]

Splits text into substrings at every occurrence of a separator.

For example, split("1_two_3", "_") is ["1", "two", "3"]

func starts_with

func starts_with(value: text, prefix: text): bool

Tests if a text starts with a prefix.

func contains

func contains(value: text, pattern: text): bool

Tests if a text contains a pattern.

func ends_with

func ends_with(value: text, suffix: text): bool

Tests if a text ends with a suffix.