---
url: /flow/guide/scripting-reference/functions/string/trim.md
---

# Trim

## Declaration

`function Trim(const S: string): string;`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := Trim(' this is text with spaces at each end '); //returns 'this is text with spaces at each end'
end;
```

## Description

Returns the given string with all leading and trailing spaces removed.
