Template:Strfind/doc

From ShoutWiki Hub
Jump to navigation Jump to search
Template:Strfind invokes Module:String using Lua.

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

Use

{{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

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

produces

5


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

produces

3


{{Strfind|abc3c%d|x}}

produces

0