Want to contribute? Join the Discord and ask for the editor role.
Template:Posnq/doc: Difference between revisions
Template page
RTGame>Alistair3149 mNo edit summary |
m (1 revision imported) |
(No difference)
|
Latest revision as of 16:52, 2 May 2021
Wrapper template for function posnq in Module:String2.
- posnq (position, no quotes) returns the numerical start position of the first occurrence of one piece of text ("match") inside another ("str").
- It returns nil if no match is found, or if either parameter is blank.
- It takes the text to be searched in as the first unnamed parameter, which is trimmed.
- It takes the text to match as the second unnamed parameter, which is trimmed and any double quotes " are stripped out. That allows spaces at the beginning or end of the match string to be included in a consistent manner.
Examples
{{Posnq |This is a piece of text to be searched |piece of }}
→ 11{{Posnq |This is a piece oftext to be searched |piece of }}
→ 11{{Posnq |This is a piece of text to be searched |"piece of "}}
→ 11{{Posnq |This is a piece oftext to be searched |"piece of "}}
→