---
title: "trim · RUAL Documentation"
description: "Removes characters from both ends of a string"
canonical: https://docs.rual.nl/block-types/value/value_trim
language: en
---

# trim

This block is part of the [`value`](https://docs.rual.nl/block-types/value) group and was last modified in core [`v10.4.28`](https://docs.rual.nl/core-versions/100428).

Removes characters from both ends of a string

- value_0 required `value` Value that will be trimmed

- trim `value` The literal string to trim from both ends, repeated occurrences of the whole string. This is not a set of characters: trimming `ab` strips the sequence `ab`, not `a` and `b` separately. Leave empty to trim whitespace

Default `whitespace`

- value `value`

With value_1 empty, trims Unicode whitespace from BOTH ends. Otherwise value_1 is treated as ONE literal string, and repeated occurrences of that WHOLE string are stripped from both ends -- it is NOT a set of characters. Example: value_0="ababXab" value_1="ab" -> "X". Nothing is removed from the middle; empty input outputs "".

A typical wiring for [trim](https://docs.rual.nl/block-types/value/value_trim): [convert to lowercase](https://docs.rual.nl/block-types/value/value_to_lowercase) feeds the `value_0` pin; the `value` out pin feeds [is not empty](https://docs.rual.nl/block-types/condition/condition_not_empty_value).

![Studio canvas example for the trim block: typical wiring for trim.](https://docs.rual.nl/canvas-examples/value_trim.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [get fields](https://docs.rual.nl/block-types/object/object_field_getter_multiple): feeds into this block. Gets the selected fields from the given object.

- [convert to lowercase](https://docs.rual.nl/block-types/value/value_to_lowercase): wired in both directions with this block.

- [is not empty](https://docs.rual.nl/block-types/condition/condition_not_empty_value): this block feeds into it. checks if the value is filled (not empty).

- [set fields](https://docs.rual.nl/block-types/mutations/mutations_set_bp_field_multiple): this block feeds into it. Generates an array of mutations based on the given filled fields.

- [remove special chars](https://docs.rual.nl/block-types/value/value_remove_special_chars): this block feeds into it. Returns the value with accents stripped. Only combining diacritical marks are removed - punctuation and symbols are kept.

- [==](https://docs.rual.nl/block-types/condition/condition_equal): this block feeds into it. returns true if the two values are equal.

### Version history

Introduced in [`v10.4.28`](https://docs.rual.nl/core-versions/100428).
