title: Twig: How to get the first character in a string
body: <p>I am implementing an alphabetical search.
  We display a table of Names. I want to highlight only those alphabets, which have names that begin with the corresponding alphabet.</p>
  
  <p>I am stumped with a simple problem.</p>
  
  <p>How to read the first character in the string user.name within twig. 
  I have tried several strategies, including the [0] operation but it throws an exception.
  Here is the code</p>
  
  <pre><code>{% for i in ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0-9'] %}
         {% set has_user_starting_with_alphabet = false %}
         {% for user in pagination %}
                {% if user.name[0]|lower == i %}
                        {% set has_user_starting_with_alphabet = true %}
                {% endif %}
         {% endfor %}
         {% if has_user_starting_with_alphabet %}
                &lt;li&gt;&lt;a href="{{ path(app.request.get('_route'), { 'search_key' : i}) }}"&gt;&lt;span&gt;{{ i }}&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
         {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Is there some function like "starts_with" in twig?</p>