4

If we have value 'cats', I want the substring 'at' (need to delete first and last letters). How can we accomplish that in a Nunjucks template?

halfer
  • 19,824
  • 17
  • 99
  • 186
himabindu
  • 336
  • 3
  • 15

1 Answers1

7

You can do this using the JavaScript slice method, like so:

{{cats.slice(1, -1)}}
halfer
  • 19,824
  • 17
  • 99
  • 186