[Solved] Word in a variable

Hello,

Could you tell me if there’s a way in Silverfin to test if a variable contains a word?

Thanks in advance ! :blush:

EDIT : I found:
{% input period.custom.president.name as:select options:manager_options %} ... {% assign president = period.custom.president.name %} (in that case, the string is 'Monsieur X') {% if president contains 'Monsieur' %}Monsieur le Président{% else %}Madame la Présidente{% endif %} ...

But it still outputs ‘Madame la Présidente’. I tried to output {{president}} and it correctly show ‘Monsieur X’

EDIT2 : Finally, just needed to capture instead of assign.
{% input period.custom.president.name as:select options:manager_options %} {% capture president %}{{period.custom.president.name}}{% endcapture %} {% if president contains 'Monsieur' %}Monsieur le Président{% else %}Madame la Présidente{% endif %}

2 Likes