# Truncate

\<evalcmd> Truncate && string && The truncated string. && string && string && Input string to truncate. && length && int && Number of characters to truncate to. && \[type] && int && Truncation type. Options are:

|   |                        |
| - | ---------------------- |
| 0 | truncate on the right  |
| 1 | truncate on the left   |
| 2 | truncate in the middle |

\</evalcmd>

Truncates the string to the specified number of characters.

If the truncation type isn't specified, the default is **2** if the input value is a *path* - otherwise the default is **0**.

If the input value is a *path* and middle truncation is selected, the function takes path separators into account correctly.

//[Example://](example://)

```
Output( Truncate("C:\Program Files\GPSoftware\Directory Opus\dopus.exe" as path, 32, 2) );
--> C:\Program Files\GP...\dopus.exe
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chaoses-ib.gitbook.io/directory-opus/manual/reference/evaluator/truncate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
