Question: How can I limit the length of the text, e.g., 50, and put three dots in the display?

```
{% if myentity.text|length > 50 %}

{% block td_text %} {{ myentity.text}}{% endblock %}

{%endif%}

```

Answer: 
@mshobnr / @olegkhuss solution made into a simple macro:

```
{% macro trunc(txt, len) -%}
    {{ txt|length > len ? txt|slice(0, len) ~ '…' : txt }}
{%- endmacro %}

```

Usage example:

```
{{ tools.trunc('This is the text to truncate. ', 50) }}

```

N.b. I import a Twig template containing macros and import it as 'tools' like this (Symfony):

```
{% import "@AppBundle/tools.html.twig" as tools -%}

```

Also, I replaced the html character code with the actual character, this should be no problem when using UTF-8 as the file encoding. This way you don't have to use `|raw` (as it could cause a security issue).
Bugginess\* in the new Drupal 8 capabilities here inspired us to write our own:

```
<a href="{{ view_node }}">{% if title|length > 32 %}{% set title_array = title|split(' ') %}{% set title_word_count = 0 %}{% for ta in title_array %}{% set word_count = ta|length %}{% if title_word_count < 32 %}{% set title_word_count = title_word_count + word_count %}{{ ta }} {% endif %}{% endfor %}...{% else %}{{ title }}{% endif %}</a>

```

This takes into consideration both words and characters (\*the "word boundary" setting in D8 was displaying nothing).