Built-in Functions
Env
Env(name)
Returns the value of the environment variable with the given name, or NULL if none.
Len
Len(value)
Returns the length of the given string, array or object (# of fields).
Slice
Slice(value, start)
Returns the substring of value from the start index to the end of string.
Slice(value, start, end)
Returns the substring of value from the start index up to but excluding the end index.
Subst
Subst(substr, replacement, text)
Replace all occurrences of the given substr in text with the replacement.
CaptureRe
CaptureRe(regex, text)
Matches text with the regular expression and returns the first capture group of matched. Returns false if not matched.
MatchRe
MatchRe(regex, text)
Returns true of the text matches the regular expression
SubstRe
SubstRe(regex, replacement, text)
Replaces all substrings of text that match the regular expression with replacement.
Prefix
Prefix(text, separator)
Returns the substring of text from the beginning up to the first occurrence of separator.
Suffix
Suffix(text, separator)
Returns the substring of text from just after the first occurrence of separator to the end of text.
Join
Join(separator, ..)
Returns the concatenation of all arguments after separator with copies of separator in between.
ArrayJoin
ArrayJoin(separator, array)
Returns the concatenation of all elements of array with copies of separator in between.
Split
Split(text, regex)
Splits text at every substring matching the regular expression and returns an array of the resulting parts not including the matches.
WordRatio
WordRatio(sentence1, sentence2)
Returns a similarity measure of two English sentences. It is the ratio of the number of common words to the total number of words.
MonetaryValue
MonetaryValue(amount)
Parses a monetary amount given as a string and returns the value in cents. Ignores leading dollar sign.
Uuid
Uuid()
Generates a version 4 UUID
Lpad
Lpad(text, length, padding)
Left pads the text and return a string at least the requested length by prepending copies of padding.
Rpad
Rpad(text, length, padding)
Right pads the text and return a string at least the requested length by appending copies of padding.
CheckDigits
CheckDigits(text, length)
Returns the checksum of a string as a string of the requested length. The checksum result will be zero padded if less than length, or truncated on the left if more than length.
CaptureNames
CaptureNames(regex, text)
Matches text with regular expression and returns named capture groups as an object. An empty object is returned if not matched.
Round
Round(value)
Returns the integer closest to value
Round(value, n)
Returns value rounded to n decimal places
Floor
Floor(value)
Returns the greatest integer less than or equal to value
Ceil
Ceil(value)
Returns the smallest integer greater than or equal value
Min
Min(..)
Return the minimum value of all the arguments.
Max
Max(..)
Return the maximum value of all the arguments.
Sqrt
Sqrt(value)
Returns the square root of value
Sin
Sin(value)
Returns the sine of value
Cos
Cos(value)
Returns the cosine of value
Tan
Tan(value)
Returns the tangent of value
ArcSin
ArcSin(value)
Returns the arc-sine of value
ArcCos
ArcCos(value)
Returns the arc-cosine of value
ArcTan
ArcTan(value)
Returns the arc-tan of value
Deg2Rad
Deg2Rad(angle)
Converts the angle in degrees to radians
Rad2Deg
Rad2Deg(angle)
Converts the angle in radians to degrees
Pi
Pi()
Returns the value of PI
Random
Random(a, b, c)
Returns a number between 0 and 1, not including 1
RandomInt
RandomInt(n)
Returns a random number between 0 and n, not including n
False
False()
Returns false
True
True()
Returns true
JsonString
JsonString(value)
Returns the JSON representation of a value
JsonParse
JsonParse(json)
Parses a JSON string and returns the value
UrlJoin
UrlJoin(url, path)
Returns the url joined with path
Now
Now()
Returns the current date/time as a string in ISO (RFC3339) format
Timestamp
Timestamp()
Returns the current number of seconds since January 1, 1970 0:00:00 UTC
TimeIn
TimeIn(delta)
Returns the current date/time + delta as a string in ISO (RFC3339) format where delta is a duration
TimeElapsed
TimeElapsed(t1, t2)
Returns the time elapsed between the date/times t1 and t2 in milliseconds (integer), where t1/t2 are in ISO (RFC3339) format
TimeElapsed(t1, t2, unit)
Returns the time elapsed between the date/times t1 and t2 in the given unit (real number) where unit is a duration and t1/t2 are in ISO (RFC3339) format
TruncTime
TruncTime(datetime)
Returns the ISO (RFC3339) formatted time date/time truncated to time=00:00:00
Time
Time(hour, minute)
Returns a time value at the given hour/minute
Time(hour, minute, second)
Returns a time value at the given hour/minute/second
TimePart
TimePart(datetime)
Returns the UTC time of a ISO (RFC3339) formatted time date/time
TimePart(datetime, timezone)
Returns local time of a ISO (RFC3339) formatted date/time
NextTick
NextTick()
Returns earliest date/time greater than now with seconds resolution
Conversation
Conversation()
Peer
Peer()
Author
Author()