Black Week 40% Off Promotion!!!
Download

{{#contains}} helper

If you need to check if some value exists in a given string which contains values separated by comma - use the {{#contains}} helper.

Syntax:

{{#contains valueToCheck valueToSearch}}
   // if the valueToCheck exists inside the valueToSearch
{{/contains}}

Examples:

{{#contains 'abc' 'abc,def'}}
abc,def contains abc
{{/contains}}

{{#contains 1 'a,1,2,d,e,f'}}
a,1,2,d,e,f contains 1
{{/contains}}

As you can see above - it also supports numbers, so if your string contains numbers you haven't to cast your first argument to string.

Examples output:

abc,def contains abc
a,1,2,d,e,f contains 1

 

What are you waiting for?

Start building your site today.

  1. 1 Download Publii
  2. 2 Write your content
  3. 3 Publish your site
Create website