Implements template .
This module looks for a word being present in a comma-separated list of words. It then returns a or value. By default, the True-value returned is the found word itself; the False-value is a blank string.
For example, in the source string '' the word '' appears, but the word '' does not.
<nowiki>{{#invoke:Str find word |main |source=foo, bar |word=bar}}</nowiki>
→
<nowiki>{{#invoke:Str find word |main |source=alpha, beta, gamma |word=november}}</nowiki>
→
Multiple word check: The search can be extended to check for multiple words being present.
AND-list of words, all words must be present:
<nowiki>{{#invoke:Str find word |main |source=alpha, beta, gamma |andwords=beta, alpha}}</nowiki>
→
<nowiki>{{#invoke:Str find word |main |source=alpha, beta, gamma |andwords=beta, omega}}</nowiki>
→
OR-list of words, at least one off the words must be present:
<nowiki>{{#invoke:Str find word |main |source=alpha, beta, gamma |orwords=beta, alpha}}</nowiki>
→
<nowiki>{{#invoke:Str find word |main |source=alpha, beta, gamma |orwords=beta, omega}}</nowiki>
→
Complete words: the complete word is '' (example needed)Whitespace is trimmed,
The module is aimed at template code usage. (The editor does not have to apply Lua patterns like).}}
Main parameters (including their synonyms)
{{Str find word |source= s= |word= andwords= andw= |orwords= orw= |case= |out-true= |out-false= }} |
{{Str find word |s= |w= |andw= |orw= |case= |out-true= |out-false=}}
{{Str find word |source = |word = }}
<nowiki>{{Str find word |source=cow, horse, dog, fish |word=dog}}</nowiki>
→
<nowiki>{{Str find word |source=cow, horse, dog, fish |word=cat}}</nowiki>
→
When the word is found in the source (True), the function returns the word itself (by default), or value (when entered non-empty).
When not found (False), the function returns a empty string, or the value when entered.
full word bar not in the source | |||||
word foobar not in the source as full word |
can be a list of words. All will be checked with the AND-requirement (each word must be present).
accepts a list of words that all will be checked with the AND-requirement (each word must be present).
Alway, both and are combined into one single AND-wordlist.
result | note | |||
---|---|---|---|---|
both words present in the source | ||||
AND-logic: A word in the AND-list is not present, so false | ||||
and are combined | ||||
result | note | ||||
---|---|---|---|---|---|
both words present in the source | |||||
and are combined | |||||
both OR-words are present in the source | |||||
OR-logic: one of the words is present, so true | |||||
none of the OR-words is present, so false |
result | note | ||||
---|---|---|---|---|---|
both words present in the source | |||||
AND-logic: A word in the AND-list is not present, so false | |||||
and are combined | |||||
both OR-words are present in the source | |||||
OR-logic: one of the words is present, so true | |||||
none of the OR-words is present, so false |
As of Mar 2023, not supported.
, Case-sensistive (A=/=a) DEFAULT
, Not case-sensistive (A=a)
result | note | ||||
---|---|---|---|---|---|
→ | |||||
→ | |||||
→ | 'foo' is not the complete word | ||||
→ | a=A (default) | ||||
→ | a=/=A |
under construction
under construction
There are no logical errors foreseen: any flaw in the input will return a False result (for example, no input strings to check were entered).