<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sarkic-cults.group/index.php?action=history&amp;feed=atom&amp;title=Module%3AString%2Fdoc</id>
	<title>Module:String/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://sarkic-cults.group/index.php?action=history&amp;feed=atom&amp;title=Module%3AString%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://sarkic-cults.group/index.php?title=Module:String/doc&amp;action=history"/>
	<updated>2026-10-22T02:14:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://sarkic-cults.group/index.php?title=Module:String/doc&amp;diff=1347&amp;oldid=prev</id>
		<title>DivošiRunner: Fill documented site and template gaps; repair verified links and flag uncertain file rights</title>
		<link rel="alternate" type="text/html" href="https://sarkic-cults.group/index.php?title=Module:String/doc&amp;diff=1347&amp;oldid=prev"/>
		<updated>2026-10-05T15:12:03Z</updated>

		<summary type="html">&lt;p&gt;Fill documented site and template gaps; repair verified links and flag uncertain file rights&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This module provides byte-oriented string helpers for templates. Its implementation uses Lua&amp;#039;s &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; library: lengths and positions count bytes, so these operations can split multibyte characters. Use &amp;lt;code&amp;gt;mw.ustring&amp;lt;/code&amp;gt; in Lua when Unicode character positions are required.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
Invoke with &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|function|arguments}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. The following names describe the deployed implementation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Function !! Parameters !! Behavior&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;len&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;s&amp;lt;/code&amp;gt; || Number of bytes.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sub&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;s, i, j&amp;lt;/code&amp;gt; || Substring with one-based inclusive positions; defaults: &amp;lt;code&amp;gt;i=1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;j=-1&amp;lt;/code&amp;gt;. Negative positions count from the end. Invalid ranges produce an error.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sublength&amp;lt;/code&amp;gt; || named &amp;lt;code&amp;gt;s, i, len&amp;lt;/code&amp;gt; || Legacy substring with a zero-based offset &amp;lt;code&amp;gt;i&amp;lt;/code&amp;gt; (default 0) and optional length.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;pos&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;target, pos&amp;lt;/code&amp;gt; || Byte at a one-based position. Negative positions count from the end; zero or out-of-range positions produce an error.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;source, target, start, plain&amp;lt;/code&amp;gt; || First match position, or 0 if absent. Defaults: &amp;lt;code&amp;gt;start=1&amp;lt;/code&amp;gt;, literal search &amp;lt;code&amp;gt;plain=true&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;str_find&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;source, target&amp;lt;/code&amp;gt; || Legacy literal search: -1 if absent, 1 for an empty target. Prefer &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; for new uses.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;match&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;s, pattern, start, match, plain, nomatch&amp;lt;/code&amp;gt; || Selected match (default 1), starting at byte 1. Uses Lua patterns by default; &amp;lt;code&amp;gt;plain=true&amp;lt;/code&amp;gt; requests literal matching. &amp;lt;code&amp;gt;nomatch&amp;lt;/code&amp;gt; supplies a fallback.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;replace&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;source, pattern, replace, count, plain&amp;lt;/code&amp;gt; || Replacement, literal by default. &amp;lt;code&amp;gt;count&amp;lt;/code&amp;gt; limits replacements; &amp;lt;code&amp;gt;plain=false&amp;lt;/code&amp;gt; enables Lua patterns.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;rep&amp;lt;/code&amp;gt; || positional text, repetition count || Repeats text.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;escapePattern&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;pattern_string&amp;lt;/code&amp;gt; || Escapes Lua pattern metacharacters.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;count&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;source, pattern, plain&amp;lt;/code&amp;gt; || Counts matches; literal matching by default.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;endswith&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;source, pattern&amp;lt;/code&amp;gt; || Returns &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt; if the source has that literal suffix, otherwise empty text.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;join&amp;lt;/code&amp;gt; || positional separator, followed by strings || Joins nonempty arguments with the separator.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Most helpers accept named parameters or positional parameters in the order shown. &amp;lt;code&amp;gt;sublength&amp;lt;/code&amp;gt; uses the named fields shown; &amp;lt;code&amp;gt;rep&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;join&amp;lt;/code&amp;gt; use positional arguments. Named arguments handled by the module&amp;#039;s parameter helper are trimmed; positional arguments retain whitespace.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Invocation !! Result&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|len|abc}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; || {{#invoke:String|len|abc}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|sub|abcdef|2|4}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; || {{#invoke:String|sub|abcdef|2|4}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|find|abcabc|bc}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; || {{#invoke:String|find|abcabc|bc}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|replace|source=a.b|pattern=.|replace=-}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; || {{#invoke:String|replace|source=a.b|pattern=.|replace=-}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String|join| / |one||two}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; || {{#invoke:String|join| / |one||two}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Patterns and errors ==&lt;br /&gt;
Lua patterns are not regular expressions; see [https://www.lua.org/manual/5.1/manual.html#5.4.1 the Lua string-library reference]. Literal replacement escapes pattern and replacement metacharacters. When pattern mode is enabled, Lua pattern and replacement rules apply.&lt;br /&gt;
&lt;br /&gt;
Functions that report errors through the module&amp;#039;s error helper display an error and can add an error category. &amp;lt;code&amp;gt;ignore_errors=true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; suppresses that output, &amp;lt;code&amp;gt;no_category=true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; suppresses the category, and &amp;lt;code&amp;gt;error_category&amp;lt;/code&amp;gt; changes its name. These options do not catch every possible Lua runtime error. Functions whose names begin with an underscore are implementation helpers.&lt;br /&gt;
[[Category:Template documentation]]&lt;/div&gt;</summary>
		<author><name>DivošiRunner</name></author>
	</entry>
</feed>