Removes leading and trailing whitespace from a string. Spacing between words is not removed.

Column reference example:

derive type:single value:TRIM(MyName)

Output: The value of the MyName column value with whitespace removed from the beginning and the end. 

String literal example:

derive type:single value:TRIM(' Hello, World ')

Output: The string Hello, World is written to the new column.

derive type:single value:TRIM(column_string)

ArgumentRequired?Data TypeDescription
column_stringYstringName of the column or string literal to be applied to the function


Name of the column or string constant to be trimmed.

Required?Data TypeExample Value
YesString literal or column referencemyColumn

Example - Trimming leading and trailing whitespace

In this example, whitespace values are identified according to this table. The ASCII value column identifies that ASCII character value that represents the character. 

ValueDefinitionASCII value
(tab)tab characterChar(9)
(cr)carriage returnChar(13)


In the following example dataset, input values are represented in the mystring. The values in the table above are represented in the string values below.

Here's my string.
(space)(space)Here's my string.(space)(space)
(tab)Here's my string.(tab)
(cr)Here's my string.(cr)
(nl)Here's my string.(nl)
(space)(space)(tab)Here's my string.(tab)(space)(space)
(space)(space)(tab)(cr)Here's my string.(cr)(tab)(space)(space)
(space)(space)(tab)(nl)(cr)Here's my string.(cr)(nl)(tab)(space)(space)


When the above CSV data is imported into the Transformer page, it is represented as the following:

Here's my string.
(space)(space)Here's my string.(space)(space)
"(tab)Here's my string.(tab)"
"(cr)Here's my string.(cr)"
"(nl)Here's my string.(nl)"
"(space)(space)(tab)Here's my string.(tab)(space)(space)"
"(space)(space)(tab)(cr)Here's my string.(cr)(tab)(space)(space)"
"(space)(space)(tab)(nl)(cr)Here's my string.(cr)(nl)(tab)(space)(space)"


You might notice the quote marks around most of the imported values. 

NOTE: If an imported string value contains tab, carriage return, or newline values, it is bracketed by double quotes.

The first step is to remove the quote marks. You can select one of the quote marks in the data grid and then select the appropriate Replace suggestion card. The transform should look like the following:

replace col: mystring on: `"` with: '' global: true

Now, you can apply the TRIM function:

derive type:single value: TRIM(mystring) as: 'trim_mystring'


In the generated trim_mystring column, you can see the cleaned strings:

Here's my string.Here's my string.
(space)(space)Here's my string.(space)(space)Here's my string.
"(tab)Here's my string.(tab)"Here's my string.
"(cr)Here's my string.(cr)"Here's my string.
"(nl)Here's my string.(nl)"Here's my string.
"(space)(space)(tab)Here's my string.(tab)(space)(space)"Here's my string.
"(space)(space)(tab)(cr)Here's my string.(cr)(tab)(space)(space)"Here's my string.
"(space)(space)(tab)(nl)(cr)Here's my string.(cr)(nl)(tab)(space)(space)"Here's my string.

Tip: If any bracketing double quotes are removed, then tab, carriage return, and newline values are trimmed by the TRIM function.

Example - String cleanup functions together