FANDOM


[edit] Template-info Template documentation
Ambox content This template is used on 2,600+ pages.
To avoid any disruptions and to save server load, any changes should first be tested in this template's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this template. As a courtesy to other users, please discuss any changes at the talk page before implementing them.

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

</div>

Community content is available under CC-BY-SA unless otherwise noted.