Template:Str find

From WikiAlpha
Revision as of 04:13, 23 August 2011 by Web (Talk | contribs) (+template)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1

[edit] [purge] Template documentation
The below content is licensed according to Creative Commons Attribution-ShareAlike License contrary to the public domain logo at the foot of the page. It originally appeared on http://en.wikipedia.org. The original article might still be accessible here. You may be able to find a list of the article's previous contributors on the talk page.

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.

Template:String templates see also