I would like to write an if condition and check if a variable contains a certain string and then write some logic.
if i have a variable say @param activity
How can I check that variable activity contains the string "abc"?
I would like to write an if condition and check if a variable contains a certain string and then write some logic.
if i have a variable say @param activity
How can I check that variable activity contains the string "abc"?
On
If you browse Closure Templates Documentation, you should be able to find what you're looking for, especially the if section. Regardless, here's an example:
{namespace com.company.my}
/**
* My Template
* @param activity
*/
{template .main}
{if $activity == 'abc'}
//do stuff
{/if}
{/template}
From the documentation (https://developers.google.com/closure/templates/docs/functions_and_directives), there is the
strContainsmethod:strContains(str, subStr)- Checks whether a string contains a particular substring.