Functions

Functions can be used in string evaluation, e.g. to perform calculations or change content depending on variable contents. They are always used in the form $functionname{argument1,argument2,...}.

math (short version "m")

Used to perform simple mathematical operation and compare numbers.
By default, the output is given either as float (always including a decimal point) or as boolean String "True" or "False". To force a different output, put "(i)", "(f)" or "(b)" at the beginning of the argument string.
Currently supported operations are +,-,*,/,<,>,<=,>=,!=(not equal),==,=(same as ==) and brackets.
Spaces are completely ignored. In particular, a scalar-times-variable multiplication must contain the * symbol.

Examples

$math{1 + 2 * 2}               => 5.0
$math{(i)1 + 2 * 2}            => 5
$math{(b)1 + 2 * 2}            => True
$math{(1+2)*2}                 => 6.0
$m{4<=7.5}                     => True
$m{(b)0}                       => False
(Assume the variable "number" is 5):
  $math{5 * ${number}}      => $math{5 * 5}      => 25
  $math{5 ${number}}        => $math{5 5}        => 55

string (short version "s")

Provides compare operations for strings. Currently supported: case insensitive comparison: <,>,<=,>=,!=(not equal),==,=(same as ==) case sensitive comparison: <<, <<=, >>, >>=, !!=, === Note that every comparison is determined by the unicode value of the characters. In the case sensitive case, this means that all capital letters come before all lower case letters. The function unescapes '\n' to the new line character. For every other escaped character, the escaping backslash will be removed.

Examples

$s{a==b}                 => False
$s{a!=b}                 => True
$s{5=5.0}                => False
(compare to: $m{5=5.0}   => True)
$string{a<<B}            => False (unicode order of lower/upper case letters)
$string{a<B}             => True
$s{a\<B}                 => a<B

if

If the first argument of this function is "false"(case insensitive), "0" or the empty string, the function string is replaced by its third argument, otherwise by the second argument. If there is no third argument, it is supposed to be the empty string.
NOTE THAT THIS FUNCTION DOES NOT PERFORM ANY FURTHER EVALUATION. Use the other functions if you need more operations.

Examples

$if{2 + 2 = 5,1984,2013}                                   => 1984
$if{$math{2 + 2 = 5},1984,2013}  => $if{False,1984,2013}   => 2013
(assume the payload is ["faLsE", "a"]):
  $if{${payload.0},${payload.1}}      => $if{faLsE,a}      => "" (empty string)

exists

To find out whether a variable with a certain name is assigned.

Examples

(Assume the variable "a" exists, and "b" does not)
  $exists{a}                   => True
  $exists{b}                   => False

tolowercase (Short version "tlc")

Converts the letters of a string to lower case

Examples

$tlc{Hello}              => hello

touppercase (Short version "tuc")

Same as "tolowercase" but - you know...

base64enc

Encodes a regular string into Base64. This includes special characters like new line.

Examples

$base64enc{text}                 =>dGV4dA==

base64dec

Decodes a Base64 string back into a regular string. Note that this function does not escape special characters, so a new line will be a new line, not "\n".

Examples

$base64dec{dGV4dA==}               => text