Module:String2/doc

From the Star Citizen Wiki, the fidelity™ encyclopedia

This is the documentation page for Module:String2

Function list
L 37 — prefix_strip
L 171 — v2p
L 253 — p._escapePattern
L 275 — p.strip
L 305 — p.matchAny
L 334 — p.hyphen_to_dash
L 371 — p.hyphen2dash
L 379 — p.startswith

This module is a helper module to be used by other modules; it may not designed to be invoked directly. See Star Citizen:Lua/Helper modules for a full list and more information.

FunctionTypeUse
trimTrims whitespace characters from the start and end of the string.
titleCapitalizes the first letter of each word in the text, apart from a number of short words: a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor.
sentenceFinds the first letter and capitalises it, then renders the rest of the text in lower case.
ucfirstFinds the first letter and capitalises it, then renders the rest of the text in lower case.
findlastFinds the last item in a list
splitSplits text at boundaries specified by separator and returns the chunk for the index idx (starting at 1).
stripZeroesFinds the first number in a string of text and strips leading zeros, but retains a zero which is followed by a decimal point. For example: "0940" → "940"; "Year: 0023" → "Year: 23"; "00.12" → "0.12"
nowikiEnsures that a string of text is treated by the MediaWiki software as just a string, not code. It trims leading and trailing whitespace.
val2percentScans through a string, passed as either the first unnamed parameter or
one2aScans through a string, passed as either the first unnamed parameter or
findpagetextReturns the position of a piece of text in the wikitext source of a page.
stripStrips the first positional parameter of the characters or pattern supplied in the second positional parameter.
matchAnyReturns the index of the first positional parameter to match the source parameter.
hyphen2dashConverts a hyphen to a dash under certain conditions. The hyphen must separate like items; unlike items are returned unmodified.
startswithMatch strings start with a pattern
🍪 We use cookies to keep session information to provide you a better experience.