Text
(Available from version 7.0 onwards.)
Sample Project for Download
An example workflow is shown for each function described below. These workflows are all included in a sample project that you can download.
-
Download the project files here.
-
Unzip the downloaded file.
-
Open the project Text_Examples in Automation Studio.
The project includes a workflow for each function. Open and run the workflows.
Functions
Combines a list of specified text strings into a single text string.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
list |
List of Text |
The list that includes the text strings to concatenate, in order. Note that instead of specifying the name of an existing list, you can create a temporary list. See here for more information. |
Returns
Returns text.
Example 1
This example concatenates the elements in the text list text_list which include the word Dear and the value of the text variable text_in, which is set to Sir. The concatenated string is written to the text variable text_out.
When the workflow is run, text_list is populated with the words Dear and Sir, and the concatenated text, Dear Sir, is stored in the variable text_out.
See Example 2, below, for an alternative solution that does not require you to populate a list with the strings to concatenate.
Example 2
This example achieves the same outcome as Example 1, above, but without having to populate the text list text_list first.
This example concatenates the word Dear and the value of the text variable text_in, which is set to Sir. The strings to concatenate are added to a temporary list. The concatenated string is written to the text variable text_out.
When the workflow is run, text_out is populated with the text Dear Sir.
Converts all upper case letters in a text to lower case.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to convert to lower case. |
Returns
The lower case text as text.
Example
This workflow sets the value of the variable text_in to New York. It then converts the text in the variable text_in to lower case and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text new york.
Converts all lower case letters in a text to upper case.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to convert to upper case. |
Returns
The upper case text as text.
Example
This workflow sets the value of the variable text_in to New York. It then converts the text in the variable text_in to upper case and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text NEW YORK.
Extracts from a text the subtext that precedes the first instance of a specified character (or any of multiple specified characters).
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text from which to extract the prefix. |
characters |
Text |
The characters that mark the end of the prefix. These characters are excluded from the prefix returned. This parameter is case sensitive. |
Returns
The extracted prefix as text.
Example 1
This workflow sets the value of the variable text_in to bob.smith@email.com. It then extracts the string preceding the first instance of the character @ from the variable text_in and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text bob.smith, which is the text that precedes the first instance of the @ character.
Example 2
This workflow sets the value of the variable text_in to bob.smith@email.com. It then extracts from text_in the string preceding the first instance of any one of multiple characters: @.. It stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text bob, which is the text that precedes the first instance of the period character.
Extracts the leftmost sequence of text that contains characters from a given set. Extraction stops when a character that is not included in the set is found.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text from which to extract the prefix. |
characters |
Text |
The characters to include. This parameter is case sensitive. |
Returns
Returns the extracted subtext as text.
Example
This workflow sets the value of the variable text_in to 40.65USD. It then begins at the left edge of text_in and extracts from it characters included in 0123456789., stopping when it reaches a character that is not included. It stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text 40.65, as the next character in text_in is U, which is not included in the list of characters to include.
Extracts a subtext of a specified length from the right edge of a given text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
no. of chars |
Number |
The number of characters to extract. |
text |
Text |
The text from which to extract the characters. |
Returns
Returns the extracted subtext as text.
Example
This workflow sets the value of the variable text_in to 1234-5678-9012-3456. It then begins at the right edge of text_in and extracts from it the rightmost four characters. It stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text 3456.
Extracts a subtext of a specified length from a given text. The extraction begins from a specified starting position, counting from the left edge of a given text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
no. of chars |
Number |
The length of the subtext to be extracted. |
text |
Text |
The source text from which to extract the subtext. |
start pos. |
Number |
The starting position in the source text from which to extract the subtext (1-based). |
Returns
Returns the extracted subtext as text.
Example
This workflow sets the value of the variable text_in to the following paragraph:
The NICE Virtual workforce comprises software robots that are installed on back-end servers, with the capabilities to take over all the repetitive, admin driven processes facing the human workforce everyday. A variety of tasks can be executed independently without human intervention, freeing up employees to focus their attention on more valuable business priorities. RPA is fast becoming the technology of choice across for a wide variety of organizations spanning any vertical market. Enterprises who embrace RPA, across the front office, back office and shared services divisions, are experiencing dramatic increases in business performance and ROI.
It then begins at the first character from the left edge of text_in and extracts 100 characters. It stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text The NICE Virtual workforce comprises software robots that are installed on back-end servers, with th.
Finds the first occurrence of a character (or any of multiple characters) in a given text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
characters |
Text |
The characters to search for in the text. This parameter is case sensitive. |
text |
Text |
The text in which to search for the characters. |
Returns
Returns the position of the character as a number (1-based).
Example
This workflow extracts the domain of an email address. It sets the value of the variable text_in to bob.smith@email.com. It finds the first occurrence of the character @ in text_in and stores the result in the variable character_pos. The workflow then uses the Get Character Count function to store the length of text_in in the variable text_length. The workflow subtracts character_pos from text_length to calculate the length of the email domain and uses the result in the function Extract Subtext by Length Leftward to extract a subtext of that length from at the right edge of text_in. The result is stored in the variable text_out.
When the workflow is run, the variable character_pos contains the number 10, indicating that @ is the 10th character of the email address. The variable text_out contains the text email.com.
Another method of extracting an email domain uses the function Reverse Order of Characters.
Finds the location of a subtext in a text, searching from a specified position in the text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
subtext |
Text |
The subtext to search for. This parameter is case sensitive. |
text |
Text |
The text in which to search. |
position |
Number |
The starting position in the text from which to search for the subtext (1-based). |
Returns
Returns the starting position of the subtext as a number (1-based).
Example
This workflow sets the value of the variable text_in to the following sentence:
The NICE Virtual workforce comprises software robots that are installed on back-end servers, with the capabilities to take over all the repetitive, admin driven processes facing the human workforce everyday.
It begins at the first character from the left edge of text_in and searches for the first occurrence of the subtext workforce. It stores the starting position of workforce in the variable number_out.
When the workflow is run, the variable number_out contains the number 18.
Finds the starting position of the last occurrence of a subtext in a text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
subtext |
Text |
The subtext to search for. |
text |
Text |
The text in which to search. |
Returns
Returns the starting position of the subtext as a number (1-based).
Example
This workflow sets the value of the variable text_in to the following sentence:
The NICE Virtual workforce comprises software robots that are installed on back-end servers, with the capabilities to take over all the repetitive, admin driven processes facing the human workforce everyday.
It begins at the right edge of text_in and searches for the last occurrence of the subtext workforce. It stores the starting position of workforce in the variable number_out.
When the workflow is run, the variable number_out contains the number 189.
Finds the position of a subtext within a text. Wildcard characters (? and/or *) can be used in the same manner as in the SQL LIKE operator.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
subtext |
Text |
The subtext to search for, including ? (representing a single character) and/or * (representing any number of characters, or no characters). This parameter is case sensitive. |
text |
Text |
The text in which to search for the subtext. |
Returns
Returns the starting position of the subtext as a number (1-based).
Example
This workflow searches the text of an email for multiple possible spellings of Mississippi and extracts the immediate context where it is mentioned.
The workflow sets the value of the variable text_in to the following text:
I'd like a quote for moving office contents from missisipi to mobile, alabama. Can you please send me a price quote and available dates for the move? Thank you
The workflow searches text_in for a subtext that matches ?is*is*ip*i.It stores the starting position of the matching subtext in the variable number_out. The workflow then extracts 100 characters from the email text, with the starting position for extraction set to 10 characters before number_out.
When the workflow is run, the variable number_out contains the number 50. The variable text_out contains the text ents from missisipi to mobile, alabama. Can you please send me a price quote and available dates for.
Counts the number of characters in a text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to count. |
Returns
Returns the number of characters as a number.
Example
This workflow counts the number of characters in a Social Security number.
The workflow sets the value of the variable text_in to 1357924680. It counts the number of characters in text_in and stores the result in the variable number_out.
If number_out does not equal 9, the following text is stored in the variable text_out: The Social Security number does not have the correct number of characters. If number_out equals 9, the following text is stored in the variable text_out: The Social Security number is the correct length.
When the workflow is run, the variable number_out contains the number 10 and the variable text_out contains the text The Social Security number does not have the correct number of characters.
Inserts a subtext into a text at a specified position.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
subtext |
Text |
The subtext to insert. |
text |
Text |
The text in which to insert the subtext. |
position |
Number |
The position at which to insert the subtext into the target text (1-based). |
Returns
Returns the text with the inserted subtext as text.
Example
This workflow sets the value of the variable text_in to the text Dear , Thank you for contacting us.. It then inserts the subtext Mr. Smith into text_in at position 6 and stores the result in the variable text_out.
When the workflow is run, text_out contains the text Dear Mr Smith, Thank you for contacting us..
Concatenates a specified string to a text repetitively at the start or the end of the text until the text reaches a specified length.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to pad. |
padOnRight |
Boolean |
Set to True to pad from the right edge of the text, or False to pad from the left edge of the text. |
no. of chars |
Number |
The desired length of the text string after padding. |
padding text |
Text |
The text to pad with. |
Returns
Returns the padded text as text.
Example
This workflow sets the value of the variable text_in to the text 12345. It pads text_in from the left with the text 0 until text_in reaches a length of 10 characters. It stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text 0000012345.
Concatenates a text a specified number of repetitions.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to repeat. |
no. of times |
Number |
The number of repetitions. |
Returns
Returns the concatenated text as text.
Example
This workflow sets the value of the variable text_in to the text 123. It repeats text_in four times and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text 123123123123.
Replaces specified subtext with alternative text. Specify how many instances of the subtext must be replaced if multiple instances of the subtext exist in the original text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
subtext |
Text |
The subtext to be replaced. |
text |
Text |
The text in which the subtext appears. |
replace text |
Text |
The alternative text to replace the subtext with. |
instances |
Number |
The number of times to replace the subtext. |
Returns
Returns the text with replaced subtext as text.
Example
This workflow sets the value of the variable text_in to the text 1Z345 Zebra St.. It replaces the subtext Z with 2 one time in text_in and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text 12345 Zebra St.. Note that only the first instance of the subtext Z was replaced.
Reverses the order of the characters in the specified text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to reverse. |
Returns
Returns the reversed text as text.
Example
This workflow extracts the domain of an email address. It sets the value of the variable text_in to bob.smith@email.com. It reverses the order of the characters in text_in and stores the result in the variable reversed_text. The workflow then uses the Extract Prefix Before Character function to extract the characters before @ from reversed_text and stores the result in the variable email_domain. The workflow then reverses the text in email_domain back to its original order and stores the result in the variable text_out.
When the workflow is run, the variable reversed_text contains the text moc.liame@htims.bob, the reverse of text_in. The variable text_out contains the text email.com.
Another method of extracting an email domain uses the function Find Character Position.
Splits text by a delimiter into a list.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to split. |
delimiter |
Text |
The delimiter by which to split the text. |
Returns
Returns the split text as a list of text.
Example
This workflow sets the value of the variable text_in to the text January,Feburary,March,April. It splits text_in at the delimiter , and stores the result in the variable text_list.
When the workflow is run, the variable text_list contains a list with four elements: January, February, March, and April.
Splits the text by a series of delimiters (contained in a text list) and returns a text list.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to split. |
delimiters |
Text list |
The delimiters by which to split the text. Note that instead of specifying the name of a list, you can instead enter a temporary list. See here for more information and an example. |
Returns
Returns the split text as a list of text.
Example
This workflow sets the value of the variable text_in as January.February,March.April. It splits text_in by the delimiters , and .. It stores the result in the variable text_list.
When the workflow is run, the variable text_list contains a list with four elements: January, February, March, and April.
Removes all occurrences of white space characters from the beginning and end of a text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to trim. |
Returns
Returns the trimmed text as text.
Example
This workflow sets the value of the variable text_in to ______________Bob Smith____________. It trims any white spaces at the beginning and end of text_in and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text Bob Smith.
Removes all occurrences of white space characters from the end of a text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to trim. |
Returns
Returns the trimmed text as text.
Example
This workflow sets the value of the variable text_in to Bob Smith____________. It trims any white spaces at the end of text_in and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text Bob Smith.
Removes all occurrences of white space characters from the start of a text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to trim. |
Returns
Returns the trimmed text as text.
Example
This workflow sets the value of the variable text_in to ______________Bob Smith. It trims any white spaces at the beginning of text_in and stores the result in the variable text_out.
When the workflow is run, the variable text_out contains the text Bob Smith.
Compares the specified text to the provided pattern, using wildcard characters (? and/or *).
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to compare. |
pattern |
Text |
The pattern for comparison, including ? (representing a single character) and/or * (representing any number of characters, or no characters). |
Case sensitive |
Boolean |
Whether or not to differentiate between upper and lower case letters. |
Returns
Returns the result of the comparison as a Boolean value, returning True if the strings match or False if they don't.
Example
This workflow sets the value of the variable text_in to Mr. John Smith. It compares text_in to the pattern m?. j* smith and sets the Case sensitive parameter to False. It stores the result in the variable boolean_var.
When the workflow is run, the variable boolean_var contains the value true, indicating that Mr. John Smith matches the pattern m?. j* smith.