String Op
Runs on: Shared (backend or chatbox overlay).
Applies a text operation to a string, from formatting such as uppercase to find-and-replace and regex.
Inputs
| Name | Type | Description |
|---|---|---|
Input | string | The text to transform. |
Arg | string | The argument for operations that need one, such as the replacement text for replace or the search term for indexOf. |
Outputs
| Name | Type | Description |
|---|---|---|
Result | string or number | The result. length and indexOf return a number, everything else a string. |
Configuration
- Operation:
- uppercase: Converts all characters to uppercase.
- lowercase: Converts all characters to lowercase.
- trim: Removes whitespace from both ends.
- concat: Appends Arg to the end of the input.
- replace: Replaces the first occurrence of Arg in the input. Use regex replace for patterns.
- split: Splits the string at the Arg delimiter and returns an array.
- length: Returns the number of characters.
- indexOf: Returns the position of Arg in the input, or -1 if not found.
- slice: Extracts a portion using Arg as the start and end positions, for example "0,5".
- regex replace: Replaces text matching the regex pattern in Arg.
Example
To show a viewer's name in capitals in an alert, connect the trigger's username to Input, set the operation to uppercase and connect Result to the alert's display name field. "nightbot" becomes "NIGHTBOT".