String Node
The String Node allows for manipulating string values on your workflow payloads.
Node Properties
The String Node takes three required values…
Source Template
A string template resolving to a string value on your payload.
Operation Configuration
The operation to perform on the string. Depending on the value selected here, additional configuration may be required. (See below.)
Operations
The String Node supports the following operations, with additional configuration required if noted (in all cases, extra configuration options take string templates):
Concatenate
Add a new value onto the end of the source string. Extra configuration:
- Additional String - The value to concatenate onto the source string.
Index Of
Find the the first occurrence of a substring within the source string, and return its index.
- Match String - The string to search for.
- Starting Index - The index from which to start the search.
Replace All Occurrences
Find all occurrences of a substring within the source string and replace them with a string of your choosing. Extra configuration:
- Match String - The value to find and to ultimately replace.
- Replacement String - The value to insert in place of the matched substring. Leave the value blank to replace with nothing.
Replace First Occurrence
Find just the first occurrence of a substring within the source string and replace it with a string of your choosing. Extra configuration:
- Match String - The value to find and to ultimately replace.
- Replacement String - The value to insert in place of the matched substring. Leave the value blank to replace with nothing.
Split
Split the source string into an array of strings, breaking on a character(s) of your choosing. The value placed at the Result Path will be an array when using this operation. Extra configuration:
- Separator Character(s) - The delimiter on which the string should be split. This is commonly a pipe
|
, comma,
or semicolon;
but it can be anything you choose.
To Lowercase
Convert all uppercase characters in the source string into lowercase characters.
To Number
Cast the source string to a number. If the string cannot be converted to a number, the value placed at the Result Path will be null
; otherwise it will be a number.
To Uppercase
Convert all lowercase characters in the source string into uppercase characters.
Trim
Remove all whitespace at the front and back ends of the source string.
Trim End
Remove all whitespace at the back end of the source string.
Trim Start
Remove all whitespace at the front end of the string.
Pad
Pad the string to the specified length using the specified character(s). Extra configuration:
- Padded Length - The desired length of the output string.
- Padding Character(s) - The character(s) that will be added to the string.
Pad End
Pad the string to the specified length by appended the specified character(s) to the end of the string. Extra configuration:
- Padded Length - The desired length of the output string.
- Padding Character(s) - The character(s) that will be added to the string.
Pad Start
Pad the string to the specified length by prepending the specified character(s) to the start of the string. Extra configuration:
- Padded Length - The desired length of the output string.
- Padding Character(s) - The character(s) that will be added to the string.
Truncate
Shorten a string to a character length of your choosing. Extra configuration:
- Max String Length - The maximum number of characters before the source string is truncated, including the length of the Ellipsis Character(s). If the source string length is less than or equal to this value, or if the string template provided here fails to cast to a number, the source string will not be changed.
- Ellipsis Character(s) - If and only if the string is truncated, characters entered here will be appended to the end of the string.
Result Path
A payload path for where the result of the string operation should be stored on your payload. This value will also be a string unless noted per operation.
Node Example
Here’s an example of the String Node’s output using the above configuration:
{
...
"data": {
"outString": ["a", "b", "c", "d", "e"]
},
...
}
Node Errors
This node will never return an error on the payload path. However, it can halt the workflow if the method is not valid or if the number of arguments passed does not match the number of arguments required for the method.
Was this page helpful?
Still looking for help? You can also search the Losant Forums or submit your question there.