str
str:addQuoteMarks
String str:addQuoteMarks(String string)
Surrounds the given string with double-quote marks.
#{str:addQuoteMarks(mystring}
Deprecated name: ctx:addQuoteMarks
str:base64encode
String str:base64encode(byte[] data)
Encodes the data using the Base64 algorithm. The result is returned as a string.
#{str:base64encode(in.raw.data}
str:base64decode
byte[] str:base64decode(String data)
Decodes the Base64 data string. The result is returned as a byte array.
#{str:base64decode('dGhpcyBpcyBhIHN0cmluZw=='}
str:cat
String str:cat(String... parts)
Concatenates a set of strings.
#{str:cat(lhs, rhs)}
Deprecated name: ctx:strcat
str:cutLength
String str:cutLength(String string. int length)
The function is used to truncate the string after a given length. If the string is shorter than this length, it is simply returned.
#{str:cutLength('veryLongString', 4)}
str:hexEncode
String str:hexEncode(byte[] data)
Encodes binary data using hexadecimal (Base16) encoding.
#{str:hexEncode(in.data.bytes)}
str:hexDecode
byte[] str:hexDecode(String data)
Decodes a string to binary data using hexadecimal (Base16) encoding.
#{str:decEncode('FF00AC1200')}
str:toLowerCaseString
String str:toLowerCaseString(Object obj)
Converts an object to its string representation and to lower-case characters.
#{str:toLowerCaseString(in.data.object)}
str:toUpperCaseString
String str:toUpperCaseString(Object obj)
Converts an object to its string representation and to lower-case characters.
#{str:toUpperCaseString(in.data.object)}
str:toString
String str:toString(Object obj)
Converts an object to its string representation by calling its toString method.
#{str:toString(in.data.object)}
str:decode
String str:decode(byte[] bytes. String codec)
Decodes some bytes into a string using the named charset codec.
#{str:decode(in.data.bytes, 'ISO-8859-1')}
str:decrypt
String str:decrypt(String encryptedText, String passphrase)
Decrypt creates a 128 bit key from the passphrase using the MD5 algorithm. The encrypted text is decoded using the Base64 algorithm and the resulting byte stream is decrypted using the generated key and the AES algorithm.
The resulting plaintext is returned.
#{str:decrypt(in.data.encData, 'secret')}
str:digest
String str:digest(String string, String algorithm)
Applies a cryptographic checksum algorithm and encodes the result using Base64.
#{ctx:digest(in.person.plaintextPassword, "SHA-256")}
The following algorithms are supported:
MD2, MD5
The message digestion algorithms No. 2 and 5.
SHA1, SHA-256, SHA-384, SHA-512
Algorithms of the secure hashing standard.
str:encode
byte[] str:encode(String string, String codec)
Encodes a string into a sequence of bytes using the named charset codec, storing the result into a new byte array.
#{ctx:encode(out.person.email, "UTF-8")}
Deprecated name: ctx:encode
The following charsets are supported:
ISO-8859-1
ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
UTF-8
Eight-bit UCS Transformation Format.
UTF-16BE
Sixteen-bit UCS Transformation Format, big-endian byte order.
UTF-16LE
Sixteen-bit UCS Transformation Format, little-endian byte order.
UTF-16
Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark.
str:encrypt
String str:encrypt(String plaintext, String passphrase)
Encrypt creates a 128 bit key from the passphrase using the MD5 algorithm. This key is then used to encrypt the plaintext using the AES algorithm. The resulting byte array is encoded using Base64 and returned as a string.
#{str:encrypt(in.data.text, 'secret')}
str:extract
String str:extract(String string, String regexp, int group)
Matches a string using a given regular expression regexp and extracts a group of the string. A group is defined by a bracket pair in the regular expression. Group 0 denotes the whole pattern. Group 1 starts at the first opening bracket and ends at the corresponding closing bracket.
#{str:extract('get1234number', '\\w+?(\\d+) \\w+', 1)}
String parameter
String to operate on.
regexp parameter
The regular expression to which this string is to be matched.
group parameter
The index of the group to extract.
str:indexOf
int str:indexOf(String string, String substring, int fromIndex)
Match a string using a given substring. The match is started from the index fromIndex. In case of no match, -1 is returned.
#{str:indexOf('string', 'in', 0)}
String parameter
String to operate on.
substring parameter
The substring to match.
fromIndex parameter
The index from which the substring matching is carried out.
str:join
String str:join(List list, String separator)
Concatenates a list of strings with a given separator string. The list can contain arbitrary objects. The toString method is called on each object to obtain a string representation.
#{str:join(cfg.alist, '*')}
str:length
int str:length(String string)
Obtains the length of a string.
#{str:length('this is a string')}
str:match
boolean str:match(String match, String regexp)
Checks whether a string matches a regular expression regexp.
#{str:match(in.user.email, '\\w+@\\w+\\. \\w+')}
str:quote
String str:quote(String string, String quoteMark, String escapeCharacter)
Surrounds the string with quote marks specified as quoteMarks. If such marks are present, they are escaped using an escape sequence specified by escapeCharacter.
#{str:quote('a "string"', '"', ' \\')}
String parameter
String to operate on.
quoteMark parameter
The string defining the opening and closing quote marks.
escapeCharacter parameter
The string put in front of an existing quote mark found in the string to escape it.
str:random
String str:random(int minCount, int maxCount)
Creates a random string which has at least minCount characters and at most maxCount characters.
#{str:random(6, 8)}
Deprecated name: ctx:random
str:randomExt
String str:randomExt(int numberCount, int lowerCharCount, int upperCharCount)
Creates a random string containing a given amount of numbers, lower and upper case characters.
#{str:randomExt(2, 4, 2)}
Deprecated name: ctx:randomExt
numberCount parameter
The number of numbers to include.
lowerCharCount parameter
The number of lower case characters to include.
upperCharCount parameter
The number of upper case characters to include.
str:replace
String str:replace(String string, String regexp, String replacement, boolean replaceAll)
String replacement based on regular expressions. Replaces all or only the first substring of this string that matches the given regular expression with the given replacement.
#{ctx:replace(in.user.mail, '\\.ch$', '.com', false)}
source parameter
`String to operate on.
regexp parameter
The regular expression to which this string is to be matched.
replace parameter
The replacement string.
global parameter
If true, all occurrences/matches of regexp are replaced, else only the first one is replaced.
str:split
List<String> str:split(String string, String regexp)
Divides the string in substrings separated by a delimiter expression regexp. Returns a list containing the substrings.
#{str:split(in.data.field, '\\s+')}
Deprecated name: ctx:split
String parameter
`String to operate on.
regexp parameter
Regular expression string used as the delimiter.
str:substring
String str:substring(String string, int fromIndex, int endIndex)
Extracts a substring from a string ranging from index fromIndex to index endIndex.
#{str:substring('123456AB', 6, 8)}
str:tr
String str:tr(String string, String is, String should)
Replaces every character in a string from the list "is" with the corresponding entry in "should". The strings "is" and "should" must have the same length.
This function can be used to replace accented characters with their unaccented version.
#{str:tr('my string', 'yj', 'ii')}
str:trim
String str:trim(String string)
Returns a copy of the string with leading and trailing whitespace omitted.
#{str:trim(string)}
str:uuid
String str:uuid()
Returns a newly generated UUID in string format.
#{str:uuid()}