# Truncate String

> Truncate a string to a certain length.

- ID: `string_truncate`
- Type: Block
- Category: [Strings](https://inventor.bot/docs/reference/blocks/strings.md)

- Value block: it can be used directly inside expressions, e.g. `"Result: " + string_truncate(Args{...})`.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `text` | yes | String to truncate. | e.g. `"hello world"` |
| `length` | yes | Maximum length. | e.g. `"5"` |
| `add_ellipses` |  | Append an ellipsis when the string is truncated. | `"false"`, `"true"` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `string` | Truncated string. | e.g. `"hello"` |

**Example**

```go
stringTruncate := string_truncate(Args{text: "hello world", length: 5})
send_text_message(Args{
	channel_id:      trigger.channel_id,
	message_content: "String: " + stringTruncate,
})
```