FANDOM


This is a documentation subpage for Template:Str contains.
It contains usage information, categories and other content that is not part of the original template page.

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.