Template:Str find/doc: Difference between revisions
Template page
More actions
creation |
m syntaxhighlight lang="wikitext" |
||
| (14 intermediate revisions by 7 users not shown) | |||
| Line 1: | Line 1: | ||
{{documentation subpage}} | {{documentation subpage}} | ||
{{Lua|Module:String}} | |||
;Usage | ;Usage | ||
: Returns the position of | : Returns the position (1 for the first character) of first appearance of ''substring'' in a ''text'', -1 if not found. | ||
: {{SandboxDocumentation}} | : {{SandboxDocumentation}} | ||
;Examples | ;Examples | ||
:* < | :* <code><nowiki>{{Str find|Panthera (genus)|P}}</nowiki></code> → {{Str find|Panthera (genus)|P}} (first character) | ||
:* < | :* <code><nowiki>{{Str find|Panthera (genus)|a}}</nowiki></code> → {{Str find|Panthera (genus)|a}} (second character) | ||
:* <code><nowiki>{{Str find|Panthera (genus)|(}}</nowiki></code> → {{Str find|Panthera (genus)|(}} | |||
:* <code><nowiki>{{Str find|Panthera (genus)|/}}</nowiki></code> → {{Str find|Panthera (genus)|/}} (means not found) | |||
:* <code><nowiki>{{Str find|Panthera (genus)|}}</nowiki></code> → {{Str find|Panthera (genus)|}} (Warning: empty substring returns 1) | |||
;Syntax | ;Syntax | ||
: < | : <syntaxhighlight lang="wikitext">{{Str find | <text> | <substring> }}</syntaxhighlight> | ||
;Parameters | ;Parameters | ||
:* '''< | :* '''<text>''' | ||
:: the tested string | :: the tested string | ||
:* '''<substring>''' | :* '''<substring>''' | ||
:: the substring to be searched in the < | :: the substring to be searched in the <text> | ||
:: [[File:Dialog-warning.svg|16px]] if <substring> is empty, this template returns 1 | |||
:: [[File:Dialog-warning.svg|16px]] you cannot search for = as it is interpreted as a parameter separator | |||
;See also | |||
:* {{tl|Str find/logic}} a subtemplate | |||
{{String templates see also}} | |||
<includeonly> | <includeonly> | ||
<!-- CATEGORIES HERE, THANKS --> | |||
[[Category:String manipulation templates]] | [[Category:String manipulation templates]] | ||
</includeonly> | </includeonly> | ||