This topic describes how to combine parameterized system functions and strings.
To combine a parameterized system function with a string or another function, directly concatenate them. Concatenation characters are not required. Examples:
To concatenate the system function ${sys.random(1,20)} and the string abc by placing the string before the system function, use the following format:
=abc${sys.random(1,20)}
.To concatenate the system function ${sys.random(1,20)} and the system function ${sys.select("a","b","c")}, use the following format:
=${sys.random(1,20)}${sys.select("a","b","c")}
.
If a parameter in a system function contains single quotation marks ('), you can directly use the single quotation marks ('). If a parameter in a system function contains double quotation marks ("), escape the double quotation marks by adding another double quotation mark before each of them. For example, you want to use the system function ${sys.md5("")}
to encrypt a string by using MD5 algorithm.
If the string is
leo say 'hi'
that contains single quotation marks ('), combine the system function and the string in the following format:=${sys.md5("leo say 'hi'")}
.If the string is
leo say "hi"
that contains double quotation marks ("), combine the function and string in the following format:=${sys.md5("leo say ""hi""")}
.
In most cases, you do not need to add double quotation marks (") if you use one system function inside another function. However, if the function parameter is a string that includes file parameters or a custom string defined by a variable or another function, or if the function parameter involves string concatenation, you must add double quotation marks ("). Examples:
=${sys.substring("abc${sys.random(1,20)}", 0, 1)}
: The substring uses a string created by concatenation. You must enclose the string in double quotation marks (").=${sys.substring(${sys.md5("${input1}${input2}")},2,5)}
: The outer substring uses a function and does not require double quotation marks ("). However, the md5 function uses a concatenation of two inputs, which requires double quotation marks (").=${sys.base64("${num2}")}
: The string parameter for the base64 function num2 comes from a data file and requires double quotation marks (").=${sys.select("{""username"":""${username}""}","blue","green")}
: The JSON string involves file parameters ${username} for the username field and requires double quotation marks (").