Module:Str find word/doc: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 9:
 
For example, in the source string '{{mono|1=foo, bar}}' the word '{{mono|1=bar}}' appears, but the word '{{mono|1=november}}' does not.
:True: <code><nowiki>{{#invoke:Str find word|main |source=foo, bar|word=bar}}</nowiki></code> <small>({{code|1=true}})</small> &rarr; {{#invoke:Str find word|main |source=foo, bar|word=bar}} ({{code|True}})
:False: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|word=november}}</nowiki></code> <small>({{code|1=false}})</small> &rarr; {{#invoke:Str find word|main |source=alpha, beta, gamma|word=november}} ({{code|False}})
 
''Multiple word check'': The search can be extended to check for multiple words being present.
 
''AND''-list of words, all words must be present:
:True: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma |andwords=beta, alpha}}</nowiki></code> <small>({{code|1=true}})</small>&rarr; >{{#invoke:Str find word |main |source=alpha, beta, gamma|andwords=beta, alpha}}<
:False: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma |andwords=beta, omega}}</nowiki></code> <small>({{code|1=false}})</small>&rarr; >{{#invoke:Str find word |main |source=alpha, beta, gamma |andwords=beta, omega}}<
 
''OR''-list of words, at least one off the words must be present:
:True: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|orwords=beta, alpha}}</nowiki></code> <small>({{code|1=true}})</small> &rarr; >{{#invoke:Str find word |main |source=alpha, beta, gamma |orwords=beta, alpha}}<
:False: <code><nowiki>{{#invoke:Str find word|main |source=alpha, beta, gamma|orwords=beta, omega}}</nowiki></code> <small>({{code|1=false}})</small>&rarr; >{{#invoke:Str find word |main |source=alpha, beta, gamma |orwords=beta, omega}}<
 
Complete words: the complete word is '{{mono|1=foobar}}' (example needed)