![]() | This is a documentation subpage for Template:Str find word. It may contain usage information, categories and other content that is not part of the original template page. |
![]() | This template is rated as alpha. It is ready for third party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
![]() | This template uses Lua: |
This template looks for a word in a comma-separated list of words. It returns a True (found) or False (not found) value.
By default, the True-value returned is the found word itself; the False-value is a blank string.
{{Str find word |source=alpha, foo, bar |word=foo}}
(True
) → foo{{Str find word |source=alpha, foo, bar |word=nov}}
(False
) →No partial fit. Partial word matching do not count as a hit:
{{Str find word |source=alpha, foobar, bar |word=foo}}
(False
) →Case-sensitive: By default, the comparison is case-sensitive (Foo ≠ foo); all text is turned into lowercase. One can make the check case-sensitive by |case=true
{{Str find word |source=alpha, Foo, bar |word=foo |case=false}}
(True
) → foo{{Str find word |source=alpha, Foo, bar |word=foo |case=true}}
(False
) →
Using this template, the editor does not have to apply patterns ('%f[^,][^,]+%f[,]'). No return value interpretation is required (like when 1 then do x), though is optionally possible. There is no inbetween-result: the logic says it is either T or F. The logic can not result in an error.