# truncatechars

Source: https://zotonic.com/docs/2383/truncatechars

URI: https://zotonic.com/id/2383

Language: en



Truncate a text to a maximum length in characters.

The text is truncated to the maximum length specified with the argument. The text is truncated at a characters boundary, use <a href="/id/doc_template_filter_filter_truncate" class="doc-reference doc-reference-filter"><code>filter#truncate</code></a> to truncate at a word boundary. If the truncation is not after punctuation then the unicode ellipsis … character is appended.

For example:

```django
{{ value|truncatechars:8 }}
```

If the value is `hello world.` then the output is `hello wo…`.

Entities like `&amp;` are counted as a single character.

Truncating character
--------------------

An optional second argument defines which text will be added if the text is truncated:

```django
{{ value|truncatechars:8:" (more)" }}
```

If the value is `hello world.` then the output is `hello wo (more)`.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2383?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2383?language=en>)
