Functions
Every function an expression can call, and what it gives back.
Text
- contains(s, sub)
True when the text contains the piece.
- endsWith(s, suffix)
True when the text ends with the suffix.
- lower(s)
Converts text to lowercase.
- replace(s, search, replacement)
Replaces every occurrence of a piece of text — a literal match, not a pattern.
- split(s, sep)
Splits text into a list at every separator.
- startsWith(s, prefix)
True when the text starts with the prefix.
- trim(s)
Removes the spaces at the start and the end of text.
- upper(s)
Converts text to UPPERCASE.
Numbers
Dates
- addDays(date, days)
Moves a date by a number of days — negative goes back. ISO in, ISO out; milliseconds in, milliseconds out.
- daysBetween(from, to)
The whole days from the first date to the second — negative when the second comes first; a part day does not count.
- formatDate(date, pattern, timezone?)
Formats a date (ISO text or milliseconds) with a pattern of yyyy MM dd HH mm ss SSS, in the workspace time zone unless you name one.
- subtractDays(date, days)
Moves a date back by a number of days — addDays the other way. ISO in, ISO out; milliseconds in, milliseconds out.
Lists
- first(list)
The first item of a list — null when the list is empty.
- join(list, sep)
Joins the items of a list into one text, with a separator between them.
- last(list)
The last item of a list — null when the list is empty.
- length(x)
Counts the items in a list, or the characters in text.
- unique(list)
The list with every duplicate removed.
Converting values
- default(x, fallback)
The value, or the fallback when the value is null — the same as ?? written as a call.
- parseJson(s)
Reads JSON text into a value you can take fields from.
- toJson(x)
Turns any value into compact JSON text.
- toNumber(x)
Turns text that is exactly one number into that number.
- toString(x)
Turns any value into text — null becomes empty text.
Encoding
- base64Decode(s)
Decodes base64 back to text.
- base64Encode(s)
Encodes text as base64 (UTF-8) — the Basic-auth header form.
- urlDecode(s)
Turns percent-encoded URL text back into plain text.
- urlEncode(s)
Makes text safe to put in a URL or a query string.
- xmlEscape(s)
Makes text safe to put inside an XML document — & < > and both quotes become entities.
Files and schemas
- file(name)
Reads a workspace file — take .text, .base64 or .size from it.
- schema(name)
Reads a workspace schema document, as it was when the run started.