Jump to content

Template:Substring?/doc

From Wikinews, the free news source you can write!

Usage

[edit]

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]

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.