# `split`
New in version 1.10.3: The `split` filter was added in Twig 1.10.3.
The `split` filter splits a string by the given delimiter and returns a listof strings:
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2</pre></div></td><td class="code"><div class="highlight"><pre>{% set foo = "one,two,three"|split(',') %}
{# foo contains ['one', 'two', 'three'] #}
</pre></div></td></tr></table>
You can also pass a `limit` argument:
>
> - If `limit` is positive, the returned array will contain a maximum oflimit elements with the last element containing the rest of string;
> - If `limit` is negative, all components except the last -limit arereturned;
> - If `limit` is zero, then this is treated as 1.
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2</pre></div></td><td class="code"><div class="highlight"><pre>{% set foo = "one,two,three,four,five"|split(',', 3) %}
{# foo contains ['one', 'two', 'three,four,five'] #}
</pre></div></td></tr></table>
If the `delimiter` is an empty string, then value will be split by equalchunks. Length is set by the `limit` argument (one character by default).
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
4
5</pre></div></td><td class="code"><div class="highlight"><pre>{% set foo = "123"|split('') %}
{# foo contains ['1', '2', '3'] #}
{% set bar = "aabbcc"|split('', 2) %}
{# bar contains ['aa', 'bb', 'cc'] #}
</pre></div></td></tr></table>
Note
Internally, Twig uses the PHP [explode](http://php.net/explode) [http://php.net/explode] or [str_split](http://php.net/str_split) [http://php.net/str_split] (if delimiter isempty) functions for string splitting.
### Arguments
- `delimiter`: The delimiter
- `limit`: The limit argument
- Twig
- Introduction
- Installation
- Twig for Template Designers
- Twig for Developers
- Extending Twig
- Twig Internals
- Deprecated Features
- Recipes
- Coding Standards
- Tags
- autoescape
- block
- do
- embed
- extends
- filter
- flush
- for
- from
- if
- import
- include
- macro
- sandbox
- set
- spaceless
- use
- verbatim
- Filters
- abs
- batch
- capitalize
- convert_encoding
- date
- date_modify
- default
- escape
- first
- format
- join
- json_encode
- keys
- last
- length
- lower
- merge
- nl2br
- number_format
- raw
- replace
- reverse
- round
- slice
- sort
- split
- striptags
- title
- trim
- upper
- url_encode
- Functions
- attribute
- block
- constant
- cycle
- date
- dump
- include
- max
- min
- parent
- random
- range
- source
- template_from_string
- Tests
- constant
- defined
- divisible by
- empty
- even
- iterable
- null
- odd
- same as