Trim Text Blanks
Verb: trimString
Trims blank spaces at the start and/or the end of a text.
Syntax
trimString --text(String) --trimoption(TrimOptions) (String)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --text | Text | Required | Text | Text that should have its leading and/or trailing blanks trimmed. |
| --trimoption | Trim option | Required | TrimOptions | Type of blank space removal.
|
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Text | Text | Text with blanks trimmed as indicated by Trim option. |
Example
Removes blanks spaces at the end of the text "IBM ".
defVar --name textToTrim --type String --value "IBM "
defVar --name trimmedText --type String
// Trim blanks only at the end (--trimoption "TrimEnd")
trimString --text "${textToTrim}" --trimoption "TrimEnd" trimmedText=value
logMessage --message "${trimmedText}" --type "Info"
// This example produces the following result:
// "IBM".