String Functions
String functions provide mechanisms for creating, transforming, and working with strings.
The examples for each function use the following notation:
- Square brackets (
[]) indicate arrays. - Curly braces (
{}) indicate groups. - Arrows (
==>) separate inputs and outputs. Inputs are shown on the left side of the arrow. Outputs are shown on the right side of the arrow.
Left
The Left function returns the specified number of characters from the left of the entered string.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: A string.
|
| Optional Argument Names and Datatypes | num char (Default: 1): An integer indicating the length of the string. |
| Modifiers | N/A |
| Output Datatype(s) | String |
The length of the string is determined by the num char value.
If the value of the arg integer exceeds the length of the string, then Left returns the complete string.
Examples
left("ABCDEFG",num_char=3) ==> "ABC"
left(["ABCDEFG","1234567","!@#$%^&"],num_char=3) ==> ["ABC","123","!@#"]
left({"ABCDEFG","1234567","!@#$%^&"},num_char=3) ==> {"ABC","123","!@#"}
left({"ABCDEFG","1234567","!@#$%^&"},num_char={1,2,3}) ==> {"A","12","!@#"}
left({["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"]},num_char=3) ==> {["ABC","123","!@#"],["ABC","123","!@#"],["ABC","123","!@#"]}
Length
The Length function returns the total number of characters in the specified string.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: A string.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | Integer |
Examples
length("ABCDEFG") ==> 7
length(["ABCDE","1234567","!@#$%^"]) ==> [5,7,6]
length({"ABCDE","1234567","!@#$%^"}) ==> {5,7,6}
length({["ABCDE","1234567","!@#$%^"],["ABCDE","1234567","!@#$%^"],["ABCDE","1234567","!@#$%^"]}) ==> {[5,7,6],[5,7,6],[5,7,6]}
Lower
The Lower function returns a string where all the characters from the input string are converted to lowercase.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: A string.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | String |
Examples
lower("ABCDEFG") ==> "abcdefg"
lower(["ABC","DEF","GHI"]) ==> ["abc","def","ghi"]
lower({"ABC","DEF","GHI"}) ==> {"abc","def","ghi"}
lower({["ABC","DEF","GHI"],["ABC","DEF","GHI"],["ABC","DEF","GHI"]}) ==> {["abc","def","ghi"],["abc","def","ghi"],["abc","def","ghi"]}
Replace All
The Replace All function returns a string where all occurrences of a given regular expression (regex) in the input string are replaced with the specified replacement string.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 3 |
| Mandatory Argument Names and Datatypes |
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | String |
Examples
replaceAll("I love pickles!", replace="pickles", with="Cogynt") ==> "I love Cogynt!"
replaceAll("I love pickles!", replace=" ", with="-") ==> "I-love-pickles!"
replaceAll("I love pickles!", replace="food", with="salads") ==> "I love pickles!"
replaceAll(["I love pickles!","I love dogs!","I love cats!"],replace=" ", with="-") ==> ["I-love-pickles!","I-love-dogs","I-love-cats"]
replaceAll({"I love pickles!","I love dogs!","I love cats!"},replace=" ", with="-") ==> {"I-love-pickles!","I-love-dogs","I-love-cats"}
replaceAll({"I love pickles!","I love dogs!","I love cats!"},replace={" ","!","don't like"}, with={"-","...","like"}) ==> {"I-love-pickles!","I love dogs...","I love cats!"}
Replace First
The Replace First function returns a string where the first occurrence of a given regular expression (regex) in the input string is replaced with the specified replacement string.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 3 |
| Mandatory Argument Names and Datatypes |
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | String |
Examples
replaceFirst("I love pickles!", replace="pickles", with="Cogynt") ==> "I love Cogynt!"
replaceFirst("I love pickles!", replace=" ", with="-") ==> "I-love pickles!"
replaceFirst("I love pickles!", replace="food", with="salads") ==> "I love pickles!"
replaceFirst(["I love pickles!","I love dogs!","I love cats!"],replace=" ", with="-") ==> ["I-love pickles!","I-love dogs","I-love cats"]
replaceFirst({"I love pickles!","I love dogs!","I love cats!"},replace=" ", with="-") ==> {"I-love pickles!","I-love dogs","I-love cats"}
replaceFirst({"I love pickles!","I love dogs!","I love cats!"},replace={" ","!","don't like"}, with={"-","...","like"}) ==> {"I-love pickles!","I love dogs...","I love cats!"}
Right
The Right function returns the specified number of characters from the right of the entered string.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: A string.
|
| Optional Argument Names and Datatypes | num char (Default: 1): An integer indicating the number of characters to return. |
| Modifiers | N/A |
| Output Datatype(s) | String |
If the value of the num char integer exceeds the length of the string, then Right returns the complete string.
Examples
right("ABCDEFG", num_char=3) ==> "EFG"
right(["ABCDEFG","1234567","!@#$%^&"],num_char=3) ==> ["EFG","567","%^&"]
right({"ABCDEFG","1234567","!@#$%^&"},num_char=3) ==> {"EFG","567","%^&"}
right({"ABCDEFG","1234567","!@#$%^&"},num_char={1,2,3}) ==> {"G","67","%^&"}
right({["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"]},num_char=3) ==> {["EFG","567","%^&"],["EFG","567","%^&"],["EFG","567","%^&"]}
Sub String
The Sub String function returns a substring from an input string, beginning with the submitted starting index and continuing to the specified length.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 2 |
| Mandatory Argument Names and Datatypes |
|
| Optional Argument Names and Datatypes | length (Default: The end of the string.): An integer specifying the length of the substring to return. If null, the default value is used. |
| Modifiers | N/A |
| Output Datatype(s) | String |
Examples
substring("ABCDEFG",start_index=2,length=3) ==> "CDE"
substring(["ABCDEFG","1234567","!@#$%^&"],start_index=2,length=3) ==> ["CDE","345","#$%"]
substring({"ABCDEFG","1234567","!@#$%^&"},start_index=2) ==> {"CDEFG","34567","#$%^&"}
substring({"ABCDEFG","1234567","!@#$%^&"},start_index={2,3,4},length={1,2,3}) ==> {"CDEFG","4567","%^&"}
Trim
The Trim function removes leading and trailing spaces from the submitted string and returns the resulting string.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: The string to trim.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | String |
Examples
trim(" X\n Y \nZ \t") ==> "X\n Y \nZ \t"
trim([" X\n Y \nZ \t"," space at beginning","space at the end. "]) ==> ["", "space at beginning", "space at the end."]
trim({" X\n Y \nZ \t"," space at beginning","space at the end. "}) ==> {"", "space at beginning", "space at the end."}
trim({[],[],[]}) ==> {[],[],[]}
Upper
The Upper function returns a string where all characters from the input string are converted to uppercase.
Usage Information
| Category | Details |
|---|---|
| Number of Arguments | 1 |
| Mandatory Argument Names and Datatypes | arg: The string to convert.
|
| Optional Argument Names and Datatypes | N/A |
| Modifiers | N/A |
| Output Datatype(s) | String |
Examples
upper("abcdefg") ==> "ABCDEFG"
upper(["abc","def","ghi"]) ==> ["ABC","DEF","GHI"]
upper({"abc","def","ghi"}) ==> {"ABC","DEF","GHI"}
upper({["abc","def","ghi"],["abc","def","ghi"],["abc","def","ghi"]}) ==> {["ABC","DEF","GHI"],["ABC","DEF","GHI"],["ABC","DEF","GHI"]}