types

string

Text values and the methods available on them.

A string is text. As a schema field it is written name: string, and a literal uses double quotes, as in "hello". Interpolation embeds values with #{}, as in "Hello, #{name}".

marreta
name = "  Ada  "
clean = name.trim().upper()
parts = "a,b,c".split(",")

Methods

NameSignatureSummary
string.lengthlength()Returns the string length.
string.upperupper()Converts to uppercase.
string.lowerlower()Converts to lowercase.
string.trimtrim()Trims surrounding whitespace.
string.containscontains(value)Returns whether the string contains text.
string.starts_withstarts_with(value)Returns whether the string starts with text.
string.ends_withends_with(value)Returns whether the string ends with text.
string.index_ofindex_of(value)Returns the index of text, or -1 when missing.
string.replacereplace(from, to)Replaces text.
string.splitsplit(separator)Splits into a list.