Template:Str find word/doc

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
Preview warning: unknown parameter "case"
{{Str find word |source=alpha, Foo, bar |word=foo |case=true}} (False)
Preview warning: unknown parameter "case"


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.


From Wikipedia, the free encyclopedia · View on Wikipedia

Developed by Nelliwinne