String manipulation
String manipulation is separate to text formatting, which is a more common use case. String manipulation alters a string value in some way to change the contents of the text. It is possible to use string manipulation functions to enhance text formatting operations in more advanced use cases.
split(text, delimeter)
Splits the text
at every instance of delimeter
, returning an array of strings. For example, split("hello world", " ")
returns an array of two text objects: ["hello", "world"]
use array indexing using []
brackets to access an element. For example split("hello world", " ")[0]
returns "hello"
.
replace(text, old, new)
Replaces every instance of old
in text
with new
. old
and new
do not have to be the same length. For example, replace("myfile.png", ".png", "")
returns "myfile"
.
strip(text)
Removes any instance of blank spaces or tabs at the beginning or end of the string. strip(" abc ")
returns "abc"
.
title(text)
Replaces characters at the beginning of the word, or immediately after any space character with the uppercase version. For example, title("lorem ipsum")
returns "Lorem Ipsum"
.
upper(text)
Replaces all characters with the uppercase version. For example, title("lorem ipsum")
returns "LOREM IPSUM"
.
lower(text)
Replaces all characters with the lowercase version. For example, title("LOREM IPSUM")
returns "lorem ipsum"
.