[edit]
Template documentation

- This documentation is transcluded from Template:Str contains/doc. (edit | history | purge)
The template {{Str contains}} searches for a substring in a string without any offset.
Usage
{{str contains|<string1>|<string2>}}
It returns 1, if string1 contains string2, otherwise it will return an empty string. This makes the result easy usable in parser functions like {{#if:|}}
.
Examples
- {{#if: {{str contains|abcdef|abc}} | Substring is found | Substring is not found }} → Substring is found
- {{#if: {{str contains|abcdef|def}} | Substring is found | Substring is not found }} → Substring is found
- {{#if: {{str contains|abcdef|efg}} | Substring is found | Substring is not found }} → Substring is not found
Community content is available under CC-BY-SA unless otherwise noted.