Im looping over an array of objects, and then trying to split one of the elements, in this case I want to split the postcode on the space. Ie. 'AB1 1AB' should just be 'AB1' .
{% for result in resultset %}
{{ result.postcode|split(' ') }}
{% endfor %}
Throws me an 'array to string error'
Trying just:
{{ result.postcode[0] }}
Throws me a 'impossible to access key [0] on a string varaible' error.
and just doing:
{{ result.postcode }}
gives me no error, with the postcode displayed as 'AB1 1AB'
Why does Twig think the string is an array when I try to split it?