StringUtils Component
The StringUtils component provides a comprehensive selection of string manipulation methods. Use the StringValue input parameter to specify the string for which you want to apply a method.
Properties
Property |
Description |
Name |
The design name of the component. |
Methods
Method |
Description |
Parameters |
Result Type |
Concat (2+ params) |
This method adds the StringAdd parameter to the StringValue. The StringAdd string is added to the end of the StringValue. Every time an input value is added to the String Add data port, the method adds a receptor for another list. The strings are added starting with the first input parameter (StringAdd1) through as many as are necessary. For example, if a Concat method had four StringAdds (StringAdd1, StringAdd2, StringAdd3 and StringAdd 4), it would start with the first and end with the fourth. |
String - StringValue. The string to which the concatenate method is applied. String - StringAdd. The string appended to the StringValue |
String - The result is the combination of StringValue and StringAdd.
|
EndsWith (2 params) |
Returns a True/False value based on the match value. The method applies to the StringValue and evaluates the last characters of the string to the match string. Here is an example: If the StringValue is: "Aid of their party” and the match is "part” the result is false. |
String - StringValue. The string to which the method is applied. String - Match. The string to which the ending of the StringValue is compared. |
Boolean. True if the parameter string is
equivalent to the end of the StringValue. |
Equal |
Use Equal to compare two strings and determine if they are equivalent. Accepts two strings as an input with another input being StringComparrison. Returns a Boolean value to show whether the strings are equivalent. You can choose from these values for StringComparrison: CurrentCulture - Compare the strings using culture-sensitive sort rules and the current culture. CurrentCultureIgnoreCase - Compare the strings using culture-sensitive sort rules and the current culture, while ignoring the case of the strings being compared. InvariantCulture - Compare the strings using culture-sensitive sort rules and the invariant culture. InvariantCultureIgnoreCase - Compare the strings using culture-sensitive sort rules and the invariant culture, while ignoring the case of the strings being compared. Ordinal - Compare the strings using ordinal (binary) sort rules. OrdinalIgnoreCase - Compare the strings using ordinal (binary) sort rules and ignore the case of the strings. Note: This method was added in version 8.0.1075. |
String - StringValue. The strings which will be compared |
Boolean. True if the parameter strings are equivalent. |
Format |
Use this method to replace one or more placeholders in a string (FormatString) with a string value. You can include multiple placeholders. When you add a placeholder value, a new input is added to the bottom of the automation block so that another placeholder value can be entered. For more information, see Specifiers for the Format Methods. Here is an example: For StringValue0 = Studio, Result: With Studio solutions, Joe Smith's handle time much is lower. Note: This method was added in version 8.0.1075. This method replaces the following, deprecated Format methods that only accepted a specific number of format parameters. |
String - FormatString. The string that contains the text you want to format. |
String - Result is a string formatted as you indicated on the automation block. |
Format (2 params)
|
Use Format to replace one or more placeholders in a string (FormatString) with the string representation of an integer (IntValue). The FormatString parameter is embedded with format items of the form, {0,alignment:formatString} where: Zero (0) indicates the IntValue placeholder that will be inserted in the Result string. Alignment An optional integer indicating the minimum width of the region to contain the formatted value. If the length of the formatted value is less than alignment, then the region is padded with spaces. If alignment is negative, the formatted value is left justified in the region; if alignment is positive, the formatted value is right justified. If alignment is not specified, the length of the region is the length of the formatted value. The comma is required if alignment is specified. formatString An optional string of formatting codes. For more information, see Specifiers for the Format Methods. The colon is required if formatString is specified. The leading and trailing braces '{' and '}', are required. To specify a single literal brace character in format, specify two leading or trailing brace characters; that is, "{{" or "}}". Here are some examples: If the value of FormatString is, "Your average handle time is {0,8:####} seconds.”, and IntVal is 255, then the return string is: "Your average handle time is……255 seconds.” In this text, the periods (.) represent spaces. If the FormatString is: "Your average handle time is {0,8:E} seconds.” With the same IntVal, the return string is: "Your average handle time is 2.550000E+002 seconds.” |
String - FormatString. The string that contains any text, reference to the IntValue, and format to apply to the IntValue. Int - IntValue. The integer to be formatted and used in the FormatString. |
String - Result is a string comprised of the IntValue inserted into the FormatString as indicated by the {0} placement.
|
Format (2 params)
|
This format method is identical to the Format 2-parameters Int, where one of the parameters is an integer. In this case, the parameter is a string. Here is an example: The StringValue0 = AHT FormatString: Your average handle time is {0,-5} seconds. Result: Your average handle time is AHT seconds. |
String - FormatString. The string that contains any text, reference to the StringValue0, and format to apply to the StringValue0. String - StringValue0.The string to be formatted and used in the FormatString. |
String - Result is a string comprised of the StringValue0 inserted into the FormatString as indicated by the {0} placement.
|
Format (2 params)
|
This format method is identical to the Format 2-parameters Int, where one of the parameters is an integer. In this case, the parameter has type DateTime. For more information, see Specifiers for the Format Method. Here are some examples: The datetime Value: 9/29/2018 current time. FormatString: Your average handle time on {0}. Result: Your average handle time on 9/29/2018 12:00:00 AM. FormatString: Your average handle time on {0,1:ddd, MMM.dd.yyyy g h:m tt z }GMT Result: Your average handle time on Fri, Sep.29.2018 A.D. 2:22 PM -4 GMT |
String - FormatString. The string that contains any text, reference to the datetime Value, and format to apply to the datetime Value. datetime - datetime Value. The datetime to be formatted and used in the FormatString. |
String - Result is a string comprised of the datetime Value inserted into the FormatString as indicated by the {0} placement.
|
Format (2 params)
|
This format method is identical to the Format 2-parameters Int, where one of the parameters is an integer. In this case, the parameter has type double. Here are some examples: With doubleValue of 45.32P FormatString: Your average handle time has increased {0} this month. Result: Your average handle time has increased 45.63 this month. FormatString: Your average handle time has increased {0,2:P} this month. Result: Your average handle time has increased 4,563.00 % this month. FormatString: Your average handle time has increased {0,2:C} this month. Result: Your average handle time has increased $45.63 this month. |
String - FormatString. The string that contains any text, reference to the double Value, and format to apply to the double Value. double - double Value.The number to be formatted and used in the FormatString. |
String - Result is a string comprised of the double numeric Value inserted into the FormatString as indicated by the {0} placement.
|
Format (2 params) You cannot add this method to solutions in version 8.0.1075 and later. Solutions that contain this method which are upgraded to 8.0.1075 or later will continue to work. |
This format method is identical to the Format 2-parameters Int, where one of the parameters is an integer. In this case, the parameter has type Boolean. Here are some examples: A checked state is sent to the BooleanValue input. When this method is triggered, the value of True or False is inserted in the FormatString. FormatString: This statement is {0} if the CheckBox Checked property is {0}. Result: This statement is False if the CheckBox Checked property is False. |
String - FormatString. The string that contains any text, reference to the Bool Value, and format to apply to the Bool Value. Boolean - boolValue. The True/False value to be formatted and used in the FormatString. |
String - Result is a string comprised of the Boolean Value inserted into the FormatString as indicated by the {0} placement.
|
Format (3 params) You cannot add this method to solutions in version 8.0.1075 and later. Solutions that contain this method which are upgraded to 8.0.1075 or later will continue to work. |
This format method is identical to the Format 2-parameters String where the parameter to be formatted and inserted into the FormatString is of type string. However, in this case there are two strings (with accompanying format indicators) that are inserted into the FormatString. The strings are referred to in the FormatString by their identifiers, 0 and 1. Here are some examples: For StringValue0 = Studio, and StringValue1 = Joe Smith FormatString: With {0} solutions, {1}'s handle time is lower. Result: With Studio solutions, Joe Smith's handle time is lower. |
String - FormatString. The string that contains any text, reference to the StringValue0, and format to apply to the StringValue0. String - StringValue0. A string to be formatted and used in the FormatString. String - StringValue1. A second string to be formatted and used in the FormatString. |
String - Result is a string comprised of the StringValue0 and StringValue1 inserted into the FormatString as indicated by the {0} and {1} placement.
|
Format (4 params) You cannot add this method to solutions in version 8.0.1075 and later. Solutions that contain this method which are upgraded to 8.0.1075 or later will continue to work. |
This format method is identical to the Format 2-parameters String where the parameter to be formatted and inserted into the FormatString is of type string. However, in this case there are three strings (with accompanying format indicators) that are inserted into the Format String. The strings are referred to in the FormatString by their identifiers, 0, 1, and 2. Here is an example: For StringValue0 = Studio, StringValue1 = Joe Smith, and StringValue2 = much. FormatString: With {0} solutions, {1}'s handle time {2} is lower. Result: With Studio solutions, Joe Smith's handle time much is lower. |
String - FormatString. The string that contains any text, reference to the StringValue0, and format to apply to the StringValue0. String - StringValue0. A string to be formatted and used in the FormatString. String - StringValue1. A second string to be formatted and used in the FormatString. String - StringValue2. A third string to be formatted and used in the FormatString. |
String - Result is a string comprised of the StringValue0, StringValue2, and StringValue2 inserted into the FormatString as indicated by the {0}, {1} and {2} placement.
|
Format (5 params) You cannot add this method to solutions in version 8.0.1075 and later. Solutions that contain this method which are upgraded to 8.0.1075 or later will continue to work. |
This format method is identical to the Format 2-parameters String where the parameter to be formatted and inserted into the FormatString is of type string. However, in this case there are four strings (with accompanying format indicators) that are inserted into the Format String. The strings are referred to in the FormatString by their identifiers, 0, 1, 2, and 3. Here is an example: For StringValue0 = Studio, StringValue1 = Joe, StringValue2 = Sales Number, and StringValue3 = Higher. FormatString: With {0} solutions, {1}'s {2} is {3}. Result: With Studio solutions, Joe's Sales Number is Higher. |
String - FormatString. The string that contains any text, reference to the StringValue0, and format to apply to the StringValue0. String - StringValue0. A string to be formatted and used in the FormatString. String - StringValue1. A second string to be formatted and used in the FormatString. String - StringValue2. A third string to be formatted and used in the FormatString. String - StringValue3. A fourth string to be formatted and used in the FormatString. |
String - Result is a string comprised of the StringValue0, StringValue1, StringValue2, and StringValue3inserted into the FormatString as indicated by the {0}, {1}, {2} and {3} placement.
|
IndexOf (2 params) |
Returns the index (position within the string) of the character supplied (Match). Note that the first position in the string has index 0. This method reads the String Value and returns the location of the first match. |
StringValue. The string to which the method is applied. Match - Character parameter. The parameter is matched against each character in the string starting at position 0. |
Integer - Represents the position in the string at which the Match character is matched for the first time. |
IndexOf (3 params) |
Returns the index (position within the string) of the character supplied (Match). The method searches for a match starting in the position indicated by StartIndex. Note that the first position in the string has index 0. This method reads the StringValue and returns the location of the first match found on or after the starting position. |
StringValue. The string to which the method is applied. Match - Character parameter for which the method searches. StartIndex - Integer parameter which denotes the location from which the search begins. |
Integer - Represents the position in the
string at which the Match character is matched for the first time
following the StartIndex. |
IndexOf (4 params) |
Returns the index (position within the string) of the character supplied (Match). The method searches for a match starting in the position indicated by the Start Index and ending at the Count. Note that the first position in the string has index 0. This method reads the current StringValue and returns the location of the first match found on or after the starting position up to the ending position. |
StringValue. The string to which the method is applied. Match - Character parameter for which the method searches. StartIndex - Integer parameter which denotes the location from which the search begins. Count - Integer parameter which denotes the number of character positions, following the start index, which are to be searched. |
Integer - Represents the position in the
string at which the Match character is matched within a substring
starting at the StartIndex through the Count value. |
Insert (3 params) |
This method creates a new string which is a combination of the original StringValue plus the new text (NewValue) inserted at the specified position (StartIndex) in the string. |
StringValue. The string to which the method is applied. Integer - StartIndex Position at which the newvalue parameter is inserted. String - NewValue. The string to be inserted in the StringValue. |
String. Result contains the original value of the StringValue and the value of the NewValue parameter inserted at the designated start index position parameter. |
IsDBNullOrEmpty |
Use this method to see if a value is DBNull or empty. Note: This method was added in version 8.0.1075. |
StringValue. The string to which the method is applied. |
Boolean. True result if the value is DBNull or empty. |
IsRegextMatch (2 params) |
This method determines if the given Regex expression (Expression parameter) is matched within the StringValue. For more information, see Commonly Used Regex Strings. |
StringValue. The string to which the method is applied. String - Expression. The Regex expression for which a match is sought. |
Boolean. True result if the Expression is
matched in the StringValue. Otherwise, false is returned. |
Join (2 params) |
This method reads the contents of a string array (val) and joins all of array items. By entering a sep value, you can insert a string or character at the places at which strings are joined. For example, if the array contains the following:
and you enter "-" as the sep value, the resulting string would be: abc-def-ghi. The sep value can be omitted to have no separation indicators in the result string. |
String - Sep The "Sep” represents the character or string of characters that denotes the separation point of strings within the input array. String array - Val. The source of string values to be joined. |
String representing the concatenation of the array (val) strings and the separation identifier (sep).
|
Join (4 params) |
This method reads the contents of a string array (val), beginning the item indicated by the First parameter and ending after the number of items indicated by the Count parameter. For the items from the First position and included in the Count, the method joins the array items. By entering a sep value, you can insert a string or character at the places at which strings are joined. Note that the array contents are counted from 0 (the first item in the array is at location 0) For example, if the array contains the following: • abc 0 • def 1 • ghi 2 and you enter "-" as the sep value, 1 as the First and 2 as the count, the resulting string would be: def-ghi. The sep value can be omitted to have no separation indicators in the result string. |
String - Sep Parameter represents the character or string of characters that denotes the separation point of strings within the input array. String array - Val The source of string values to be joined. Int - First The index of the first item in the array to be joined. Int - Count The number of items, following the First, to be included in the Join. |
String representing the concatenation of the array (val) strings and the separation identifier (sep) including only the items in the val array starting with the First position and ending at the First + Count position.
|
LastIndexOf (2 params) |
This method returns the index of the last position at which the match string is found. For example, given the string: "The time has come” And match value "me” The result is: 15 as in "come” |
StringValue. The string to which the method is applied. String - match. The string for which the match is sought. |
Int - Result is index number of the position at which the match string is located in the StringValue.
|
LastIndexOf (3 params) |
This method returns the index of the last position at which the match string is found within a substring of the initial StringValue comprised of the characters from index 0 to the start index. For example, if the string is: "The time has come” And the match value is "me”, given a startindex of 15 returns index position 6 (as in "time”). |
StringValue. The string to which the method is applied. String - match The string for which the match is sought. Int - startindex. The position in the string at which the search for the match ends. |
Int - the index of the position in the StringValue at which the match is found.
|
LastIndexOf (4 params) |
This method returns the index of the last position at which the match string is found within a substring of the initial stringValue comprised of the characters ending with the start index and of length "count”. For example, if the string is: "The time has come” And the match value is "e”, given a startindex of 10 and count of 10, returns index position 7 (as in "time”).
|
StringValue. The string to which the method is applied. String - match The string for which the match is sought. Int - startindex The position in the string at which the search for the match ends. Count - The number of characters prior to the startindex from which the search substring is created. |
Int - the index of the position in the StringValue at which the match is found.
|
Length (1 param) |
Returns the length of the input string. |
StringValue. The string to which the method is applied. |
Int – Result is the number of characters (including spaces) contained in the StringValue.
|
PadLeft (2 params) |
This method right-aligns the characters in the string Value by inserting spaces in the beginning of the string (left) for the specified total width. |
StringValue. The string to which the method is applied. Int - totalwidth Sets the width of the resulting string. |
String result which is the original StringValue
with spaces added to the beginning of the string and resulting
in a string of the length specified (totalwidth). |
PadRight (3 params) |
This method left-aligns the characters in the string Value by inserting spaces at the end of the string (right), for the specified total width. |
StringValue. The string to which the method is applied. Int - totalwidth Sets the width of the resulting string. |
String result which is the original StringValue
with spaces added to the end of the string and resulting in a
string of the length specified (totalwidth). |
RegexReplace (3 params) |
This method Replaces all occurrences of a character pattern defined by a regular expression (expression parameter) with a specified replacement character string (new value). For example, for the string value: "For all good men.” With this replacement expression: "good” and NewValue of "strong”, the result is: "For all strong men.” |
StringValue. The string to which the method is applied. String - expression. The Regex string indicating the text in the StringValue to match. String - NewValue. The text string to be inserted in the StringValue in the place of the matching string. |
String - a new string in which the original StringValue has been modified such that the matching characters are replaced by the NewValue string.
|
RegexReplace (4 params) |
This method replaces up to the specified number of occurrences (count) of a character pattern defined by a regular expression (expression parameter) with a specified replacement character string (new value). For example, for the StringValue: "The time has come for all good men to come to the aid of their party.” With this replacement expression: come, NewValue of gone, and count of 1, the result is: "The time has gone for all good men to come to the aid of their party.” |
StringValue. The string to which the method is applied. String - expression. The Regex string indicating the text in the StringValue to match. String - NewValue. The text string to be inserted in the StringValue in the place of the matching string. Int - Count. The number of matching occurrences to be replaced. |
String - a new string in which the original StringValue has been modified such that the matching characters are replaced by the NewValue string.
|
RegexReplace (5 params) |
This method replaces up to the specified number of occurrences (count) of a character pattern defined by a regular expression (expression parameter) with a specified replacement character string (new value) starting at a specified character position in the input string. For example, for the StringValue: "The time has come for all good men to come to the aid of their party.” With this replacement expression: "come”, NewValue of "go”, and count of 1, and Startat value of 17 the result is: "The time has come for all good men to go to the aid of their party.” |
StringValue. The string to which the method is applied. String - expression. The Regex string indicating the text in the StringValue to match. String - NewValue. The text string to be inserted in the StringValue in the place of the matching string. Int - Count. The number of matching occurrences to be replaced. Int - Startat. The position in the string from which the replacements can be made. |
String - a new string in which the original StringValue has been modified such that the matching characters are replaced by the NewValue string.
|
Remove (2 params) |
Deletes characters from the StringValue beginning at a specified position (startindex). |
StringValue. The string to which the method is applied. Int - StartIndex. The position within the string from which characters are deleted from the StringValue. |
String - result is the StringValue after
characters have been deleted. |
Remove (3 params) |
Deletes a specified number of characters (count) from the StringValue beginning at a specified position (StartIndex). |
StringValue. The string to which the method is applied. Int - StartIndex. The position within the string from which characters are deleted from the StringValue. Int - Count. The number of characters, beginning at the StartIndex, to delete. |
String - result is the StringValue after
characters have been deleted. |
Replace (3 params) |
Replaces all occurrences of a specified string ( ) in the StringValue with another string ( ). |
StringValue. The string to which the method is applied. String - OldValue. The string to replace in the StringValue. String - NewValue. The string to insert in the StringValue in all places where the OldValue is displayed. |
String - result is a new string where the
OldValue has been replaced with the NewValue. |
Split (2 params) |
Creates a string array of substrings based on the StringValue. The substrings are delineated with the specified character (Delim parameter). |
StringValue. The string to which the method is applied. Character/string - Delim a character or string of characters which delineate substrings in the StringValue. |
String Array - result is a string array formed
by substrings of the StringValue. |
Split (3 params) |
Creates a string array of substrings based on the StringValue and the count parameter. The substrings are delineated with a specified character (Delim parameter). The total number of array elements to create is specified in the count parameter. |
StringValue. The string to which the method is applied. Character/string - Delim a character or string of characters which delineate substrings in the StringValue. Int - Count. The total number of array elements to create from the StringValue. |
A string array of elements comprised of substrings
from the StringValue. |
StartsWith (2 params) |
Determines whether the beginning of the StringValue matches the specified string parameter (match). |
StringValue. The string to which the method is applied. String - match. The match parameter is a string to which the beginning of the StringValue is compared. |
Boolean - result is True if the match parameter
is identical to the beginning of the StringValue. |
Substring (2 params) |
This method returns a substring from the StringValue beginning at the position indicated by the startIndex parameter. |
StringValue. The string to which the method is applied. Int - startIndex. The starting position in the StringValue at which the substring is retrieved. |
String - result is a string retrieved from
the StringValue beginning at the startIndex parameter and including
all subsequent characters from the StringValue. |
Substring (3 params) |
This method returns a substring from the StringValue beginning at the position indicated by the startIndex parameter and includes subsequent characters until the specified length (length parameter) is reached. |
StringValue. The string to which the method is applied. Int - startIndex. The starting position in the StringValue at which the substring is retrieved. Int - length. The length of the substring to retrieve. |
String - result is a string retrieved from
the StringValue beginning at the start index and of a specified
length. |
ToLower (1 param) |
This method returns the StringValue in lowercase characters. |
StringValue. The string to which the method is applied. |
String - equivalent to the StringValue comprised
of all lowercase characters. |
ToUpper (1 param) |
This method returns the StringValue in uppercase characters. |
StringValue. The string to which the method is applied. |
String - equivalent to the StringValue comprised
of all uppercase characters. |
Trim (1 param) |
This method returns the StringValue with any leading white spaces or trailing white spaces removed. |
StringValue. The string to which the method is applied. |
String - equivalent to the StringValue with all leading and trailing spaces removed. |
Related information
Using the StringUtils Component
Privacy | Trademarks | Terms of Use | Feedback
Updated: 18 June 2020
© 2016 - 2020 Pegasystems Inc. Cambridge, MA All rights reserved.