--- title: "String Actions" slug: "string-actions" description: "This is a list of actions that can be taken in RapidIdentity Connect to interact with strings." updated: 2022-06-03T13:47:26Z published: 2022-06-03T13:47:26Z canonical: "help.rapididentity.com/string-actions" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.rapididentity.com/llms.txt > Use this file to discover all available pages before exploring further. # String Actions ## String Actions ### splitString 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 | ```actionscript result = splitString("713-555-1212","-") ``` ### stringContains 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 | ```actionscript containsNumber = stringContains("Sup3rD00per", "/\d/") ``` ### stringEndsWith 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 | ```actionscript isLast4Digits = stringEndsWith("555-666-7777", "/\d{4}/") ``` ### stringEquals 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 | ```actionscript isEmailAddress = stringEquals("jdoe@example.com", "/ [a-zA-Z]+@[a-zA-Z]+\.[a-zA-Z]{2,3}/") ``` ### stringEscape 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 | ```actionscript name = user.sn + ", " + user.givenName escapedName = stringEscape(name, "ldap-dn") dn = "cn=" + escapedName + ",cn=users,dc=example,dc=com") ``` ### stringFromTemplate 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 | ```actionscript name = user.sn + ", " + user.givenName dn = stringFromTemplate("cn=%cn%,cn=users,dc=example,dc=com", {cn: name}) ``` ### stringLength 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 | ```actionscript len = stringLength("jdoe@example.com") ``` ### stringRemoveDiacriticals 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 | ```actionscript # Should return "TestaaeeiioooouuuuAAEEIIOOOOUUUU" s = stringRemoveDiacriticals("Testaáeéiíoóö?uúü?AÁEÉIÍOÓÖ?UÚÜ?") ``` ### stringRepeat 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 | ```actionscript varIndentString = stringRepeat(" ", varIndentLevel * 4) ``` ### stringReplaceAll 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 | ```actionscript phoneNumber = stringReplaceAll("713.555.1212",".","-") ``` ### stringReplaceFirst 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 | ```actionscript phoneNumber = stringReplaceFirst("713.555.1212",".","-") ``` ### stringStartsWith 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 | ```actionscript startsWith3Digits = stringStartsWith("713.555.1212",/\d{3}/) ``` ### stringToLower 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 | ```actionscript result = stringToLower("JDoe@Example.COM") ``` ### stringToUpper 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 | ```actionscript result = stringToUpper("JDoe@Example.COM") ``` ### subString 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 | ```actionscript guid = "{03265F05-6D90-4AC1-9A97-0A432ACA761A}" # remove leading and trailing {} result = subString(guid, 1, guid.length - 2) ``` ### toString 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 | ```actionscript # convert number to string result = toString(5) ```