Template:Str find long/doc
< Template:Str find long
Revision as of 11:57, 21 March 2013 by Unknown user (talk)
Usage
{{str find|text|sub_string}} = Position of first appearance of sub_string in text.
- Only searches first 80 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).
Examples
Template:1x{{Template:1x|Template:1xTemplate:1xTemplate:1x|Template:1xTemplate:1xTemplate:1x}}Template:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1x
gives "1" [1]Template:1x{{Template:1x|Template:1xTemplate:1xTemplate:1x|Template:1xTemplate:1xTemplate:1x}}Template:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1x
gives "2" [2]Template:1x{{Template:1x|Template:1xTemplate:1xTemplate:1x|Template:1xTemplate:1xTemplate:1x}}Template:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1x
gives "3" [3]Template:1x{{Template:1x|Template:1xTemplate:1xTemplate:1x|Template:1xTemplate:1xTemplate:1x}}Template:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1x
gives "4" [4]Template:1x{{Template:1x|Template:1xTemplate:1xTemplate:1x|Template:1xTemplate:1xTemplate:1x}}Template:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1x
gives "6" [5]Template:1x{{Template:1x|Template:1xTemplate:1xTemplate:1x|Template:1xTemplate:1xTemplate:1x}}Template:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1x
gives "7" [6]Template:1x{{Template:1x|Template:1xTemplate:1xTemplate:1x|Template:1xTemplate:1xTemplate:1x}}Template:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1xTemplate:1x
gives "-1" [7]
Applications
See also
Description of all string templates