String Actions
Split a string on a delimiter into an array of strings.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the original string |
delimiter* | text, expression, variable | the delimiter pattern - may be a "string" or a /regex/ |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
result = splitString("713-555-1212","-")Check if a string contains a pattern.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the string to compare with |
pattern* | text, expression, variable | the pattern to compare against - may be a "string" or a /regex/ |
ignoreCase | boolean, expression, variable | ignore case when comparing characters (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
containsNumber = stringContains("Sup3rD00per", "/\d/") Check if a string ends with a pattern.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the string to compare with |
pattern* | text, expression, variable | the pattern to compare against - may be a "string" or a /regex/ |
ignoreCase | boolean, expression, variable | ignore case when comparing characters (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
isLast4Digits = stringEndsWith("555-666-7777", "/\d{4}/")Compare a string for equality.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the string to compare with |
pattern* | text, expression, variable | the pattern to compare against - may be a "string" or a /regex/ |
ignoreCase | boolean, expression, variable | ignore case when comparing characters (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
isEmailAddress = stringEquals("jdoe@example.com", "/
[a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]{2,3}/") Escape string(s).
Property | Value | Description |
|---|---|---|
text* | text, expression, variable | a string, array , or record containing text to be escaped |
method* | choice (ecmascript, html, java, ldap-dn, ldap-filter, sql, mysql, postgresql, url, xml), text, expression, variable | the escaping method |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
name = user.sn + ", " + user.givenName escapedName = stringEscape(name, "ldap-dn") dn = "cn=" + escapedName + ",cn=users,dc=example,dc=com")
Create a string from a template and arguments.
Property | Value | Description |
|---|---|---|
format* | text, expression, variable | the template string containing %name% references to indexes/fields/properties in args |
args* | expression, variable | an Array, Record, or Object containing arguments to be used by the format string |
escapeMethod | choice (ecmascript, html, java, ldap-dn, ldap-filter, sql, mysql, postgresql, url, xml), text, expression, variable | the escaping method to apply to values from args |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
name = user.sn + ", " + user.givenName
dn = stringFromTemplate("cn=%cn%,cn=users,dc=example,dc=com", {cn: name})Get the length of a string.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the string |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
len = stringLength("jdoe@example.com")Remove diacriticals from characters in a string
Property | Value | Description |
|---|---|---|
text* | text, expression, variable | a string |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
# Should return "TestaaeeiioooouuuuAAEEIIOOOOUUUU"
s = stringRemoveDiacriticals("Testaáeéiíoóö?uúü?AÁEÉIÍOÓÖ?UÚÜ?")Return a new string with a specified number of copies of the original
Property | Value | Description |
|---|---|---|
text* | text, expression, variable | a string |
count* | expression, variable | number of times to repeat |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
varIndentString = stringRepeat(" ", varIndentLevel * 4)Replace all instances of a pattern within a string.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the original string |
pattern* | text, expression, variable | the pattern to replace - may be a "string" or a /regex/ |
replacement | text, expression, variable | the replacement string |
ignoreCase | boolean, expression, variable | ignore case when comparing characters (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
phoneNumber = stringReplaceAll("713.555.1212",".","-")Replace the first instance of a pattern within a string.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the original string |
pattern* | text, expression, variable | the pattern to replace - may be a "string" or a /regex/ |
replacement | text, expression, variable | the replacement string |
ignoreCase | boolean, expression, variable | ignore case when comparing characters (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
phoneNumber = stringReplaceFirst("713.555.1212",".","-") Check if a string starts with a pattern.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the string to compare with |
pattern* | text, expression, variable | the pattern to compare against - may be a "string" or a /regex/ |
ignoreCase | boolean, expression, variable | ignore case when comparing characters (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
startsWith3Digits = stringStartsWith("713.555.1212",/\d{3}/)Convert a string to lower-case.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the string |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
result = stringToLower("JDoe@Example.COM")Convert a string to upper-case.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the string |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
result = stringToUpper("JDoe@Example.COM")Get a portion of a string.
Property | Value | Description |
|---|---|---|
string* | text, expression, variable | the original string |
startIndex* | expression, variable | the starting index (starting at 0) of the sub-string within the original string |
length | expression, variable | the length of the sub-string within the original string (default: end of original string) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
guid = "{03265F05-6D90-4AC1-9A97-0A432ACA761A}"
# remove leading and trailing {}
result = subString(guid, 1, guid.length - 2)Get the string representation of a value.
Property | Value | Description |
|---|---|---|
value* | text, expression, variable | the value |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
# convert number to string result = toString(5)