Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Str find/doc: Difference between revisions

Template page
subtemplate
m syntaxhighlight lang="wikitext"
 
(9 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{documentation subpage}}
{{documentation subpage}}


{{Lua|Module:String}}
;Usage
;Usage
: Returns the position (1 for the first character) of first appearance of ''substring'' in a ''text'', 1 if not found.
: Returns the position (1 for the first character) of first appearance of ''substring'' in a ''text'', -1 if not found.
: {{SandboxDocumentation}}
: {{SandboxDocumentation}}


;Examples
;Examples
:* <tt><nowiki>{{Str find|Panthera (genus)|P}}</nowiki></tt> &rarr; {{Str find|Panthera (genus)|P}}
:* <code><nowiki>{{Str find|Panthera (genus)|P}}</nowiki></code> &rarr; {{Str find|Panthera (genus)|P}} (first character)
:* <tt><nowiki>{{Str find|Panthera (genus)|a}}</nowiki></tt> &rarr; {{Str find|Panthera (genus)|a}}
:* <code><nowiki>{{Str find|Panthera (genus)|a}}</nowiki></code> &rarr; {{Str find|Panthera (genus)|a}} (second character)
:* <tt><nowiki>{{Str find|Panthera (genus)|(}}</nowiki></tt> &rarr; {{Str find|Panthera (genus)|(}}
:* <code><nowiki>{{Str find|Panthera (genus)|(}}</nowiki></code> &rarr; {{Str find|Panthera (genus)|(}}
:* <tt><nowiki>{{Str find|Panthera (genus)|=}}</nowiki></tt> &rarr; {{Str find|Panthera (genus)|=}}
:* <code><nowiki>{{Str find|Panthera (genus)|/}}</nowiki></code> &rarr; {{Str find|Panthera (genus)|/}} (means not found)
:* <code><nowiki>{{Str find|Panthera (genus)|}}</nowiki></code> &rarr; {{Str find|Panthera (genus)|}} (Warning: empty substring returns 1)


;Syntax
;Syntax
: <pre><nowiki>{{Str endswith | <text> | <substring> }}</nowiki></pre>
: <syntaxhighlight lang="wikitext">{{Str find | <text> | <substring> }}</syntaxhighlight>


;Parameters
;Parameters
Line 19: Line 21:
:* '''<substring>'''
:* '''<substring>'''
:: the substring to be searched in the <text>
:: 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
;See also
:* {{Str find/logic}} a subtemplate
:* {{tl|Str find/logic}} a subtemplate
{{String templates see also}}
{{String templates see also}}


<includeonly>
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
<!-- CATEGORIES HERE, THANKS -->
 
[[Category:String manipulation templates]]
[[Category:String manipulation templates]]
[[ar:قالب:Str find]]
[[de:Vorlage:Str find]]
[[en:Template:Str find]]
[[eo:Ŝablono:Lin serĉi]]
[[es:Plantilla:Str find]]
[[hsb:Předłoha:Str find]]
[[id:Templat:Str find]]
[[it:Template:Str find]]
[[ja:Template:Str find]]
[[ur:Template:Str find]]
</includeonly>
</includeonly>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.