Check if string contains substring in VHS 2.4
<p>How can I check if a string contains a specific substring?
E.g. I have an array of objects called <code>{category.files}</code> and output each object name.</p>

<pre><code>&lt;f:for each="{category.files}" as="file"&gt;
    &lt;p&gt;{file.name}&lt;/p&gt;
&lt;/f:for&gt;
</code></pre>

<p>Now I try to check if the name contains a specific substring and if true output it? In my case I search for the substring <strong>fire</strong>.</p>

<p>I found the VHS Method <a href="https://fluidtypo3.org/viewhelpers/vhs/1.9.1/If/String/ContainsViewHelper.html" rel="nofollow">contains</a> but I don't know how to use it, since there is no real example included.</p>

<p>How does it work in my case?</p>

<pre><code>&lt;f:for each="{category.files}" as="file"&gt;
                                  ???            ???                 ??
    &lt;v:if.string.contains then="[mixed]" else="[mixed]" haystack="{file}" needle="fire"&gt;
       &lt;!--output it if found --&gt;

       &lt;!-- else, do nothing --&gt;
    &lt;/v:if.string.contains&gt;
&lt;/f:for&gt;
</code></pre>

<p>So in other words, I try to search <strong>fire</strong> in the <strong>haystack</strong>.</p>