> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# trimEnd

> Use the trimEnd task to remove whitespace from the end of a string.

The `trimEnd` task removes whitespace — including spaces and tabs — from the end of a string.

## Potential use case

Use `trimEnd` to ensure that no trailing spaces remain in string values within a dataset.

## Properties

| Incoming | Type   | Description                                              |
| :------- | :----- | :------------------------------------------------------- |
| `str`    | String | Required. The string to remove trailing whitespace from. |

| Outgoing     | Type   | Description                                              |
| :----------- | :----- | :------------------------------------------------------- |
| `trimmedEnd` | String | A new string with whitespace removed from its right end. |

## Example

In this example, a **newVariable** task is used to create the input for `trimEnd`. The variable name is `String` and its value is `Hello World` with spaces at both the beginning and end.

![](/_fern-img/7e361dadc4f2627ed79643f66cebdac2b327cdbb0fb9d86132643e670da58d5c.webp)

The `trimEnd` task references `New Variable: String` as the reference task. The reference variable is automatically set to accept the value from that task.

![](/_fern-img/2c1bcbbd4cefb878d7d834a13824dc079d719d6a533f1a064cc2a5c4a4a4d7d6.webp)

After running the job, the incoming variable in **Task History** shows spaces before and after `Hello World`, indicated by the placement of the quotation marks.

![](/_fern-img/e504eb95c6cc5ab9cc4f289fcf05b80a2ef213d47fa427a089d4af8ef1dd92d2.webp)

The outgoing `trimmedEnd` value is `"Hello World"` with the trailing whitespace after `World` removed.

![](/_fern-img/e81e0896e245ec9f3620b068bf537cac4872ba313db1d3f866420e40d31dbe70.webp)