# \[Solved\] Word in a variable

**URL:** https://community.silverfin.com/t/solved-word-in-a-variable/33
**Category:** Templates
**Tags:** input, control\_flow, if
**Created:** [January 30, 2017, 8:07am UTC](https://community.silverfin.com/t/solved-word-in-a-variable/33 "2017-01-30T08:07:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Axel](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@Axel](https://community.silverfin.com/u/Axel)
#### Post date: [January 30, 2017, 8:07am UTC](https://community.silverfin.com/t/solved-word-in-a-variable/33/1 "2017-01-30T08:07:04Z")

</div>

Hello,

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

Thanks in advance ! 😊

**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 %}`

---

<div class="post-metadata">

### Author: ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)
#### Post date: [April 3, 2017, 3:10pm UTC](https://community.silverfin.com/t/solved-word-in-a-variable/33/2 "2017-04-03T15:10:10Z")

</div>


