- 23 May 2023
-
DarkLight
-
PDF
trim
- Updated on 23 May 2023
-
DarkLight
-
PDF
trim Task Purpose
The trim task is used to remove whitespace from both ends of a string (the beginning and the end).
Potential Use Case
If you want to make sure no spaces have been added at the beginning and end of your dataset in a string entry, then use the trim task to find and remove them.
Properties
Input and output parameters are shown below.
Incoming | Type | Description |
---|---|---|
str |
string | Required. The string to remove whitespace from. |
Outgoing | Type | Description |
---|---|---|
noWhitespace |
string | A new string representing the input str stripped of whitespace from both ends. |
Example
In this example, a New Job Variable named "String" is used to input the data into the trim task and the value is Hello World, with spaces at the beginning and the end of the string.
Next, the trim task is used to reference New Variable: String within the Reference task. The Reference variable is automatically set to accept the incoming str
value from the Reference task that is used as input.
After running the job, notice that the incoming variable has whitespace before and after the words Hello World (as shown by the placement of the quotation marks).
The noWhitespace
result that returns will be "Hello World" and the whitespace has been removed.