String services
Use String services to perform string manipulation and substitution operations.
base64Decode
Decodes a Base-64 encoded string into a sequence of bytes.
Input parameters for base64Decode
- string: String. A Base64-encoded String to decode into bytes.
-
encoding: String. Specifies the encoding method. Default value is ASCII.
Output parameters for base64Decode
value: byte[]. The sequence of bytes decoded from the Base64-encoded String.
base64Encode
Converts a sequence of bytes into a Base64-encoded String.
Input parameters for base64Encode
- bytes: byte[] - Sequence of bytes to encode into a Base64-encoded String.
- useNewLine: String. Flag indicating whether to retain or
remove the line breaks. Set to:
-
trueto retain the line breaks. This is the default. -
falseto remove the line breaks.
-
- encoding: String. Specifies the encoding method. Default value is ASCII.
Output parameters for base64Encode
value: String. Base64-encoded String encoded from the sequence of bytes.Usage notes for base64Encode
By default, the base64Encode service inserts line breaks after 76 characters of data, which is not the canonical lexical form expected by implementations such as MTOM. You can use the useNewLine parameter to remove the line breaks.
bytesToString
Converts a sequence of bytes to a String.
Input parameters for bytesToString
- bytes: byte[]. Sequence of bytes to convert to a String.
- encoding: String. Name of a registered, IANA character set (for example, ISO-8859-1). If you specify an unsupported encoding, the system throws an exception. To use the default encoding, set encoding to autoDetect.
- ignoreBOMChars: String. Flag indicating whether or not the
byte order mark (BOM) characters in the input sequence of bytes are removed before converting the
byte array to string. Set to:
-
trueto remove the byte order mark (BOM) characters before converting the input sequence of bytes to string, if the byte array contains BOM characters. -
falseto include the byte order mark (BOM) characters while converting the input sequence of bytes to string. The default is false.
-
Output parameters for bytesToString
string: String. String representation of the contents of bytes.compareStrings
Performs a case-sensitive comparison of two strings and indicates whether the strings are identical.
Input parameters for compareStrings
- inString1: String. String to compare against inString2. This input variable can be null.
- inString2: String. String to compare against inString1. This input variable can be null.
Output parameters for compareStrings
isEqual: String. Indicates whether or not inString1 and inString2 are identical.-
trueindicates that inString1 and inString2 are identical. -
falseindicates that inString1 and inString2 are not identical.
concat
Concatenates two strings.
Input parameters for concat
- inString1: String. String to which you want to concatenate another string.
- inString2: String. String to concatenate to inString1.
Output parameters for concat
value: String. Result of concatenating inString1 with inString2 (inString1 + inString2).
fuzzyMatch
A given string is not exactly matched against a set of strings. If the match exceeds the similarityThreshold, it returns the matchedValue. If more than one string has not exactly matched, then the first matched string is returned.
Input parameters for fuzzyMatch
- inString: String. Text to be matched. Text should not be empty or null.
- matchData []: String. Array of strings, which are used for matching. If the string array value is either empty or null, it is not used for matching.
- similarityThreshold: String. If the inexact match score exceeds the given threshold, then service output contains the matchedValue parameter. Default value is 0.65. Valid values should be between 0.0 and 1.0. Value 0.0 represents no match and value 1.0 represents an exact match.
- algorithm: String. The algorithm used for an inexact match. Default value is Levenshtein. Supported algorithms are Levenshtein and JaroWinkler.
Output parameters for fuzzyMatch
- matchedValue: String. If the inexact match meets or exceeds the similarityThreshold, the returned value will contain the matched string.
- similarity: String. If the inexact match exceeds the similarityThreshold, then it contains a similarity score. It provides the measure of how close the match is. The returned value can be between 0.0 and 1.0. Value 0.0 represents no match and value 1.0 represents an exact match.
Usage notes for fuzzyMatch
Search the web for more information about Levenshtein and JaroWinkler algorithms.
HTMLDecode
Replaces HTML character entities with native characters.
Specifically, this service:
| Replaces this HTML character entity... | With... |
|---|---|
>
|
>
|
<
|
<
|
&
|
&
|
"
|
"
|
Input parameters for HTMLDecode
inString: String. An HTML-encoded String.
Output parameters for HTMLDecode
value: String. Result from decoding the contents of inString. Any HTML character entities that existed in inString will appear as native characters in value.
HTMLEncode
Replaces HTML-sensitive characters with equivalent HTML character entities.
Specifically, this service:
| Replaces this native language character... | With... |
|---|---|
>
|
>
|
<
|
<
|
&
|
&
|
"
|
"
|
‘
|
'
|
These translations are useful when displaying text in an HTML context.
Input parameters for HTMLEncode
inString: String. The character you want to encode in HTML.Output parameters for HTMLEncode
value: String. Result from encoding the contents of inString. Any HTML-sensitive characters that existed in inString, for example, > or &, will appear as the equivalent HTML character entities in value.
indexOf
Returns the index of the first occurrence of a sequence of characters in a string.
Input parameters for indexOf
- inString: String. String in which you want to locate a sequence of characters.
- subString: String. Sequence of characters to locate.
- fromIndex: String. Index of inString from which to start the search. If no value is specified, this parameter contains 0 to indicate the beginning of the string.
Output parameters for indexOf
value: String. Index of the first occurrence of subString in inString. If no occurrence is found, this parameter contains -1.
isAlphanumeric
Determines whether a string consists entirely of alphanumeric characters (in the ranges A–Z, a–z, or 0–9).
Input parameters for isAlphanumeric
inString: String. String to be checked for alphanumeric characters.
Output parameters for isAlphanumeric
trueindicates that all the characters in inString are alphanumeric.falseindicates that not all the characters in inString are alphanumeric.
The service returns false if inString is not specified.
isDate
Determines whether a string follows a specified date pattern.
Input parameters for isDate
- inString: String. String to be checked for adherence to the specified date pattern.
- pattern: String. Date format for specifying the inString parameter (for example, yyyyMMdd HH:mm:ss.SSS). For more information about the pattern strings that can be specified for the date, see the Pattern String Symbols section.
Output parameters for isDate
trueindicates that inString follows the specified date pattern.falseindicates that inString does not follow the specified date pattern.
The service returns false if inString is not specified.
Usage notes for isDate
The service returns an error if both inString and pattern are not specified.
You can specify any random string (for example, 111212) as both inString and pattern. The service returns true if the same user-defined string is specified as both inString and pattern. This is because the java.text.SimpleDateFormat class parses the user-defined input string and pattern to a valid date when the particular input values are identical.
isNullEmptyOrWhitespace
Determines if a string is null, empty, or only whitespace.
Input parameters for isNullEmptyOrWhitespace
-
inString: String. String to be checked.
-
*ifPresent: Boolean.
- If the value is set to true, the service checks whether inString is present or not, and only then proceeds with validation of the input.
- If the value is set to false, the service throws an exception when inString is absent. Else, the service proceeds to validate the input.
Output parameters for isNullEmptyOrWhitespace
-
isNullEmptyOrWhitespace: String. Indicates whether inString is null, empty, or only whitespace.
- true indicates that inString has a null value, is empty, or is only whitespace.
- false indicates that inString is not null, not empty, or is not only whitespace.
- Examples
-
Service with inString = " \t\n\r\n" and ifPresent = true, returns true
Usage notes for isNullEmptyOrWhitespace
string:isNullEmptyOrWhitespace replaces string:isNullOrBlank which is deprecated.
isNullOrBlank
Checks a string for a null or a blank value.
Input parameters for isNullOrBlank
-
inString: String. String to be checked for a null or a blank value.
-
ifPresent: Boolean. Set to one of the following values:
- true indicates the service checks whether inString is present or not, and only then proceeds with validation of the input.
- false indicates the service throws an exception when inString is absent. Else, the service proceeds to validate the input.
Output parameters for isNullOrBlank
-
true indicates that inString has either a null or a blank value.
-
false indicates that inString contains a value that is not null.
If inString is not specified, the service considers the string to be blank and returns true.
isNumber
Determines whether the contents of a string can be converted to a float value.
Input parameters for isNumber
inString: String. String to be checked for conversion to float.
Output parameters for isNumber
- true indicates that inString can be converted to a float value.
- false indicates that inString cannot be converted to a float value.
The service returns false if inString is not specified.
length
Returns the length of a string.
Input parameters for length
inString: String. String whose length you want to discover.
Output parameters for length
value: String. The number of characters in inString.
lookupDictionary
Looks up a given key in a hash table and returns the string to which that key is mapped.
Input parameters for lookupDictionary
-
hashtable: java.util.Hashtable. Hash table that uses String objects for keys and values.
-
key: String. Key in hashtable whose value you want to retrieve. The key is case sensitive.
Output parameters for lookupDictionary
value: String. Value of the string to which key is mapped. If the requested key in hashtable is null or if key is not mapped to any value in hashtable, the service returns null.
lookupTable
Locates a key in a String Table and returns the string to which that key is mapped.
Input parameters for lookupTable
- lookupTable: String [] []. A multi-row, multi-column string table in which to search.
- keyColumnIndex: String. Index of the key column. Default is 0.
- valueColumnIndex: String. Index of the value column. Default is 1.
- key: String. Key to locate.Note: The key is case sensitive.
- ignoreCase: String. Flag indicating whether to perform a
case-sensitive or case-insensitive search. Set to:
- true to perform a case-insensitive search.
- false to perform a case-sensitive search. This is the default.
- useRegex: String. Flag indicating whether the values in the
table are to be interpreted as regular expressions.Note: The regular expressions in the table should not include slashes. For example, use hello., not /hello.
Output parameters for lookupTable
value: String. First value in the value column whose key matches key. If no match is found, this parameter is null.
makeString
Builds a single string by concatenating the elements of a String List.
Input parameters for makeString
- elementList[]: String List. Strings to concatenate.
- separator: String. String to insert between each non-null element in elementList.
Output parameters for makeString
value: String. Result from concatenating the strings in elementList. Strings are separated by the characters specified in separator.
messageFormat
Formats an array of strings into a given message pattern.
Input parameters for messageFormat
- pattern: String. Message that includes placeholders where elements
from argumentList are to be inserted. The message can contain any sequence of characters. Use the
{n}placeholder to insert elements from argumentList, where n is the index of the element that you want to insert.For example, the following pattern string inserts elements 0 and 1 into the message: Test results: {0} items passed, {1} items failed.
Note: Do not use any characters except digits for n. - argumentList: String List. List of strings to use to populate pattern. If argumentList is not supplied, the service will not replace placeholders in pattern with actual values.
Output parameters for messageFormat
value: String. Result from substituting argumentList into pattern. If pattern is empty or null, this parameter is null.
numericFormat
Formats a number into a given numeric pattern.
Input parameters for numericFormat
- num: String. The number to format.
- pattern: String. A pattern string that describes the way in which num is to be
formatted:
This symbol... Indicates... 0A digit. #A digit. Leading zeroes will not be shown. .A placeholder for a decimal separator. ,A placeholder for a grouping separator. ;A separation in format. -The default negative prefix. %That num will be multiplied by 100 and shown as a percentage. XAny character used as a prefix or suffix (for example, A,$).'That special characters are to be used as literals in a prefix or suffix. Enclose the special characters within '' (for example, '#'). The following are examples of pattern strings:
Pattern Description #,###Use commas to separate into groups of three digits. The pound sign denotes a digit and the comma is a placeholder for the grouping separator. #,####Use commas to separate into groups of four digits. $#.00Show digits before the decimal point as needed and exactly two digits after the decimal point. Prefix with the $ character. '#'#.0Show digits before the decimal point as needed and exactly one digit after the decimal point. Prefix with the # character. The first character in a pattern is the dollar sign ($). The pound sign denotes a digit and the period is a placeholder for decimal separator.
Output parameters for numericFormat
value: String. num formatted according to pattern. If pattern is an empty (not null) string, the default pattern of comma separators is used and the number of digits after the decimal point remains unchanged.
objectToString
Converts an object to string representation using the Java™ toString() method of the object.
Input parameters for objectToString
object: Object. The object to be converted to string representation.
Output parameters for objectToString
string: String. String representation of the input object converted using the Java toString() method of the object.
padLeft
Pads a string to a specified length by adding pad characters to the beginning of the string.
Input parameters for padLeft
- inString: String. String that you want to pad.
- padString: String. Characters to use to pad inString.
- length: String. Total length of the resulting string, including pad characters.
Output parameters for padLeft
value: String. Contents of inString preceded by as many pad characters as needed so that the total length of the string equals length.
Usage notes for padLeft
If padString is longer than one character and does not fit exactly into the resulting string, the
beginning of padString is aligned with the beginning of the resulting string. For example, suppose
inString equals shipped and padString equals x9y.
| If length equals... | Then value will contain... |
|---|---|
7
|
shipped
|
10
|
x9yshipped
|
12
|
x9x9yshipped
|
If inString is longer than length characters, only the last length characters from
inString are returned. For example, if inString equals
acct1234 and length equals 4, value will contain
1234.
padRight
Pads a string to a specified length by adding pad characters to the end of the string.
Input parameters for padRight
- inString: String. String that you want to pad.
- padString: String. Characters to use to pad inString.
- length: String. Total length of the resulting string, including pad characters.
Output parameters for padRight
value: String. Contents of inString followed by as many pad characters as needed so that the total length of the string equals length.
Usage notes for padRight
If padString is longer than one character and does not fit exactly into the
resulting string, the end of padString is aligned with the end of the resulting string.
For example, suppose inString equals shipped and padString equals
x9y.
| If length equals... | Then value will contain... |
|---|---|
7
|
shipped
|
10
|
shippedx9y
|
12
|
shippedx9y9y
|
If inString is longer than length characters, only the first length characters from
inString are returned. For example, if inString equals
1234acct and length equals 4, value will contain
1234.
replace
Replaces all occurrences of a specified substring with a substitute string.
Input parameters for replace
- inString: String. String containing the substring to replace.
- searchString: String. Substring to replace within inString.
- replaceString: String. Character sequence that will replace searchString. If this parameter is null or empty, the service removes all occurrences of searchString from inString.
- useRegex: String. Flag indicating whether searchString is a
regular expression. When regular expressions are used to specify a search string, replaceString may
also contain interpolation fields (for example, "$1") that match parenthetical subexpressions in
searchString. Set to:
- true: To indicate that searchString is a regular expression.
- false: To indicate that searchString is not a regular expression. This is the default.
Output parameters for replace
value: String. Contents of inString with replacements made.
stringToBytes
Converts a string to a byte array.
Input parameters for stringToBytes
- string: String. String to convert to a byte[].
- encoding: String. Name of a registered, IANA character set that specifies the encoding to use when converting the String to an array of bytes (for example: ISO-8859-1). To use the default encoding, set this value to autoDetect. If you specify an unsupported encoding, an exception will be thrown.
Output parameters for stringToBytes
bytes: byte[]. Contents of string represented as a byte[].
substitutePipelineVariables
Replaces a pipeline variable with its corresponding value.
Input parameters for substitutePipelineVariables
inString: String. String containing the pipeline variable to
replace. Specify the name of the pipeline variable between the % symbols (for
example, %phone%).
Output parameters for substitutePipelineVariables
value: String. Contents of inString with the pipeline variable replaced.
Usage notes for substitutePipelineVariables
The service returns an error if inString is not specified.
If inString does not contain any variable between the % symbols, or contains a
value other than the pipeline variable between the % symbols, the service does not
perform any variable substitution from the pipeline.
If you want to include the % symbol in the output, you can specify it as
\% in inString. To specify the value of the pipeline variable as a percentage in
the output, append \% after the variable name in inString. For example, suppose a
pipeline variable revenueIncreasePercent has a value of 100.
| If inString equals... | Then value will contain... |
|---|---|
%revenueIncreasePercent%\%
|
100%
|
The service cannot be used for substitution of global variables.
substring
Returns a substring of a given string.
Input parameters for substring
- inString: String. String from which to extract a substring.
- beginIndex: String. Beginning index of the substring to extract (inclusive).
- endIndex: String, Ending index of the substring to extract (exclusive). If this parameter is null or empty, the substring will extend to the end of inString.
Output parameters for substring
value: String. Substring from beginIndex and extending to the character at endIndex - 1.
tokenize
Tokenizes a string using specified delimiter characters and generates a String List from the resulting tokens.
This service does not return delimiters as tokens.
Input parameters for tokenize
- inString: String. String you want to tokenize, that is, break into delimited chunks.
- delim: String. Delimiter characters. If null or empty, the service uses the default
delimiters
\t\n\r, where t, n, and r represent the white space characters tab, new line, and carriage return. - useRegex: Boolean. If the value is set to true, webMethods Integration supports recognizing the delimiter character set for the delim parameter as a regular expression. If the value is set to false, webMethods Integration considers the delimiter character set for the delim parameter as an individual character. This is the default.
Output parameters for tokenize
valueList []: String List. Strings containing the tokens extracted from inString.
toLower
Converts all characters in a given string to lowercase.
Input parameters for toLower
- inString: String. String to convert.
- language: String. Lowercase, two-letter ISO-639 code. If this parameter is null, the system default is used.
- country: String. Uppercase, two-letter ISO-3166 code. If this parameter is null, the system default is used.
- variant: String. Vendor and browser-specific code. If null, this parameter is ignored.
Output parameters for toLower
value: String. Contents of inString, with all uppercase characters converted to lowercase.
toUpper
Converts all characters in a given string to uppercase.
Input parameters for toUpper
- inString: String. String to convert.
- language: String. Lowercase, two-letter ISO-639 code. If this parameter is null, the system default is used.
- country: String. Uppercase, two-letter ISO-3166 code. If this parameter is null, the system default is used.
- variant: String. Vendor and browser-specific code. If null, this parameter is ignored.
Output parameters for toUpper
value: String. Contents of inString, with all lowercase characters converted to uppercase.
trim
Trims leading and trailing white space from a given string.
Input parameters for trim
inString: String. String to trim.
Output parameters for trim
value: String. Contents of inString with white space trimmed from both ends.
URLDecode
Decodes a URL-encoded string.
Input parameters for URLDecode
inString: String URL-encoded string to decode.
Output parameters for URLDecode
value: String. Result from decoding inString. If inString contains plus (+) signs, they will appear in value as spaces. If inString contains %hex encoded characters, they will appear in value as the appropriate native character.
URLEncode
URL-encodes a string.
Encodes characters the same way that data posted from a WWW form is encoded, that is, the application/x-www-form-urlencoded MIME type.
Input parameters for URLEncode
inString: String. String to URL-encode.
Output parameters for URLEncode
value: String. Result from URL-encoding inString. If inString contains
non-alphanumeric characters (except [-_.*@]), they will appear in value as their
URL-encoded equivalents (% followed by a two-digit hex code). If inString contains spaces, they will
appear in value as plus (+) signs.