twig check substring code example
Example 1: twig if first in string contains
{% if 'World' starts with 'F' %}
{% endif %}
Example 2: test if string in string twig
{# returns true #}
{{ 1 in [1, 2, 3] }}
{{ 'cd' in 'abcde' }}
{% if 'World' starts with 'F' %}
{% endif %}
{# returns true #}
{{ 1 in [1, 2, 3] }}
{{ 'cd' in 'abcde' }}