<p>If you are attempting to get a count of the string, you can use Twigs dump function.</p>

<p>{{ dump(myString) }}</p>

CC BY-SA 3.0
2014-06-14T17:23:47.217Z
This only works in devMode from what I've read. Never tried it outside of devMode, though.
Bill Criswell
CC BY-SA 3.0
2014-06-14T09:16:11.523Z
2014-06-14T09:16:11.523Z
Jason McCallister
<p>Twig has a <a href="http://twig.sensiolabs.org/doc/filters/length.html">length filter</a> that can help you with that:</p>

<pre><code>{% set stringLength = "Simple String" | length %}
</code></pre>

<p>Note that this also works on arrays to give you the number of items in the array.</p>

CC BY-SA 3.0
2014-06-14T06:53:40.967Z
2014-06-14T06:53:40.967Z
Josh Angell
<p>Lets say I have a simple string:</p>

<pre><code>{% set string = "Simple String" %}
</code></pre>

<p>How to get number of characters of my string?</p>

<string>
How to check how many characters there are in my string?
# How to check how many characters there are in my string?

(Asked by: username_0 on 2014-06-14)

Lets say I have a simple string:
{% set string = "Simple String" %}

How to get number of characters of my string?

**Tags:** string

---

## 2 answers

### Answer by username_3 on 2014-06-14. Score: 8 | Accepted answer

Twig has a length filter that can help you with that:
{% set stringLength = "Simple String" | length %}

Note that this also works on arrays to give you the number of items in the array.


---

### Answer by username_1 on 2014-06-14. Score: 2

If you are attempting to get a count of the string, you can use Twigs dump function.

{{ dump(myString) }}

> **Comments:**
> **username_2**: This only works in devMode from what I've read. Never tried it outside of devMode, though.  

---

