contains

Conditional statement to check if there is a string inside other

1
2
3
{{#contains [value] [find]}}
...
{{/contains}}
Example
format JSON XML
HTML
1
2
3
4
5
{
"RecipeBook": {
"description": "These fresh carrot recipes are exploding with delicious flavor."
}
}
Code
1
2
3
{{#contains RecipeBook.description "carrot"}}
There are recipes with carrots
{{/contains}}
Result
HTML
1
<RecipeBook description="These fresh carrot recipes are exploding with delicious flavor."></RecipeBook>
Code
1
2
3
{{#contains RecipeBook.description "carrot"}}
There are recipes with carrots
{{/contains}}
Result

Params

1
2
3
4
{{#contains
"string"
"string to find"
}}