Template:Strfind

ShoutWiki — express yourself and be heard!
Jump to: navigation, search
Template:Strfind invokes Module:String using Lua.

The position of the first occurrence of a pattern within a string

Use[edit]

{{Strfind|string|pattern|start=index|plain=Boolean}}

string
the string to search
pattern
the substring to find
start
(optional, default: 1) the position of the first character to begin searching; an integer between 1 and the length of the string; negative numbers specify a position from the end of the string
plain
(optional, default: true) pattern should be considered literal text rather than a Lua pattern expression

Examples[edit]

{{Strfind|abc3c%d|c%d}}

produces

5


{{Strfind|abc3c%d|c%d|plain=false}}

produces

3


{{Strfind|abc3c%d|x}}

produces

0