I have a title field with value: "Nobel Participatie Portefeuille".

On my template I want to trim the word "Nobel", You can do this with twig trim.

so this is my code:

{{ entry.title | trim('Nobel ') }}

But my output is "Nobel Cashflow Portefeui" (missing "lle")

Other words work normal.


So this would be a better solution:

{{ entry.title|replace('/^Nobel /', '') }}

Thanks for the support Craft!

| improve this answer | |
  • 1
    I was going to comment and tell you that would be a better solution, but that wasn't the question you asked you Twitter. ;) – Justin Kimbrell Jan 9 '15 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.