Closed o-l-e closed 11 years ago
The trim filter strips whitespace (or other characters) from the beginning and end of a string. It does not remove items from inside the string: http://twig.sensiolabs.org/doc/filters/trim.html
What are you trying to do? Just remove the , comma? You could use split or replace filters: http://twig.sensiolabs.org/doc/filters/split.html http://twig.sensiolabs.org/doc/filters/replace.html
I don't know if Stacey updated to the latest Twig yet though, so not quite sure what filters are available to use.
Hey Karl thank you so much, the replace filter worked like this:
Tags: {{ page.tags|replace({"," : ""}) }}
What i was trying to do was remove the comma. Sorry about asking stupid questions. I am really not comfortable with twig yet, i am still learning, so i really appreciate the help here.
Ps: I did do an update of the Twig parser like referenced here: https://github.com/kolber/stacey/pull/91 So i don't know if the replace filter will work with the current version of Stacey(have not tried).
I have created a variable in my project.txt that looks like this:
Then i try to trim the "," in order to inject the result into a class like this:
For some reason it does not trim the commas. Am i doing this wrong, or is this filter not possible in Stacey?
Thanks.