Jump to content

Template:Str find

From The Austrian Economics Wiki, the global repository of classical-liberal thought
Revision as of 12:51, 27 April 2011 by John James (talk | contribs) (Created page with "{{#titleparts: {{str find/logic|{{{1|}}}|{{{2|}}}|{{str len|*{{{2|}}}*}}-2}}-1 | 1 }}<noinclude> {{documentation}}</noinclude>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1

Documentation icon Template documentation[view] [edit] [history] [purge]
This article uses content from the Wikipedia article on Template:Str find/doc (edition) under the terms of the CC-by-SA 3.0 license.

Usage

{{Str find|text|sub_string}} = Position of first appearance of sub_string in text.

  • Only searches first 50 characters of text. Returns -1 if sub_string not found in first 80 characters.
  • Character position is 1 based (not 0 based as usual in calculations).
  • Warning: if sub_string is empty, then this routine will return 1 !!! This case will often have to be handled specially.

See also

Template:Strfind short can handle longer strings (<99 chars), and gives far better performance, especially for short strings.

Description of all string templates