Template:Substring?/doc

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Usage[edit source]

Provide two strings as unnamed parameters. If the second string is contained in the first (including, if they're the same string), returns the 1-indexed position of the second string within the first; otherwise, returns blank

Internals[edit source]

This is not meant to be part of a suite of string-manipulation tools; for general string manipulations, use {{evalx}}. Rather, this template is meant for a class of situations that may be quite common: a page contains a very large number of simple tests to distinguish separate cases, where all, or most, cases can be handled entirely with magic words; so that lots of server load can be saved by doing the test with Module:Substring? rather than Module:Wikilisp.