<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://2d4chan.org/mediawiki/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="http://2d4chan.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AString%2Fdoc"/>
	<link rel="alternate" type="text/html" href="http://2d4chan.org/mediawiki/index.php?title=Module:String/doc&amp;action=history"/>
	<updated>2026-05-01T05:21:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>http://2d4chan.org/mediawiki/index.php?title=Module:String/doc&amp;diff=1002983&amp;oldid=prev</id>
		<title>2d4fag: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://2d4chan.org/mediawiki/index.php?title=Module:String/doc&amp;diff=1002983&amp;oldid=prev"/>
		<updated>2025-02-14T01:05:47Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:05, 14 February 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>2d4fag</name></author>
	</entry>
	<entry>
		<id>http://2d4chan.org/mediawiki/index.php?title=Module:String/doc&amp;diff=1002982&amp;oldid=prev</id>
		<title>PathfinderWiki&gt;Virenerus at 11:29, 25 October 2024</title>
		<link rel="alternate" type="text/html" href="http://2d4chan.org/mediawiki/index.php?title=Module:String/doc&amp;diff=1002982&amp;oldid=prev"/>
		<updated>2024-10-25T11:29:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Wikipedia|Module:String/doc}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;String&amp;#039;&amp;#039;&amp;#039; module provides basic string functions previously offered by [[mediawikiwiki:Extension:StringFunctions|the StringFunctions extension]] and not replaced by [[mediawikiwiki:Extension:ParserFunctions|the ParserFunctions extension]].&lt;br /&gt;
&lt;br /&gt;
Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If you use named parameters, the MediaWiki software automatically removes any leading or trailing whitespace from the parameter.&lt;br /&gt;
&lt;br /&gt;
== Global options ==&lt;br /&gt;
&lt;br /&gt;
; ignore_errors &amp;#039;&amp;#039;(optional)&amp;#039;&amp;#039;&lt;br /&gt;
: If set to {{xt|true}} or {{xt|1}}, any error condition results in an empty string being returned instead of an error message.&lt;br /&gt;
; error_category &amp;#039;&amp;#039;(optional)&amp;#039;&amp;#039;&lt;br /&gt;
: If an error occurs, specifies the name of a category to include with the error message. The default category is [[:Category:Errors reported by Module String]].&lt;br /&gt;
; no_category &amp;#039;&amp;#039;(optional)&amp;#039;&amp;#039;&lt;br /&gt;
: If set to {{xt|true}} or {{xt|1}}, don&amp;#039;t add any categories if an error is generated.&lt;br /&gt;
&lt;br /&gt;
== len ==&lt;br /&gt;
&lt;br /&gt;
This function returns the length of the target string.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|len|&amp;#039;&amp;#039;target_string&amp;#039;&amp;#039;}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|len|s= &amp;#039;&amp;#039;target_string&amp;#039;&amp;#039; }}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; s&lt;br /&gt;
: The string whose length to report&lt;br /&gt;
&lt;br /&gt;
== sub ==&lt;br /&gt;
&lt;br /&gt;
This function returns a substring of the target string at specified indices.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|sub|&amp;#039;&amp;#039;target_string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;start_index&amp;#039;&amp;#039;|&amp;#039;&amp;#039;end_index&amp;#039;&amp;#039;}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|sub|s= &amp;#039;&amp;#039;target_string&amp;#039;&amp;#039; |i= &amp;#039;&amp;#039;start_index&amp;#039;&amp;#039; |j= &amp;#039;&amp;#039;end_index&amp;#039;&amp;#039; }}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; s&lt;br /&gt;
: The string to return a subset of.&lt;br /&gt;
; i &amp;#039;&amp;#039;(optional)&amp;#039;&amp;#039;&lt;br /&gt;
: The first index of the substring to return, defaults to 1.&lt;br /&gt;
; j &amp;#039;&amp;#039;(optional)&amp;#039;&amp;#039;&lt;br /&gt;
: The last index of the string to return, defaults to the last character.&lt;br /&gt;
&lt;br /&gt;
The first character of the string is assigned an index of 1. If either &amp;#039;&amp;#039;&amp;#039;i&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;j&amp;#039;&amp;#039;&amp;#039; is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of &amp;#039;&amp;#039;&amp;#039;-1&amp;#039;&amp;#039;&amp;#039; is the same as selecting the last character of the string.&lt;br /&gt;
&lt;br /&gt;
If the requested indices are out of range for the given string, an error is reported.&lt;br /&gt;
&lt;br /&gt;
== match ==&lt;br /&gt;
&lt;br /&gt;
This function returns a substring from the source string that matches a specified pattern.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|match|&amp;#039;&amp;#039;source_string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;pattern_string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;start_index&amp;#039;&amp;#039;|&amp;#039;&amp;#039;match_number&amp;#039;&amp;#039;|&amp;#039;&amp;#039;plain_flag&amp;#039;&amp;#039;|&amp;#039;&amp;#039;nomatch_output&amp;#039;&amp;#039;}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke:&amp;lt;/nowiki&amp;gt;String|match|s= &amp;#039;&amp;#039;source_string&amp;#039;&amp;#039; |pattern= &amp;#039;&amp;#039;pattern_string&amp;#039;&amp;#039; |start= &amp;#039;&amp;#039;start_index&amp;#039;&amp;#039;|match= &amp;#039;&amp;#039;match_number&amp;#039;&amp;#039;|plain= &amp;#039;&amp;#039;plain_flag&amp;#039;&amp;#039; |nomatch= &amp;#039;&amp;#039;nomatch_output&amp;#039;&amp;#039; }}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; s&lt;br /&gt;
: The string to search&lt;br /&gt;
; pattern&lt;br /&gt;
: The pattern or string to find within the string&lt;br /&gt;
; start&lt;br /&gt;
: The index within the source string to start the search.  The first character of the string has index 1.  Defaults to 1.&lt;br /&gt;
; match&lt;br /&gt;
: In some cases it may be possible to make multiple matches on a single string.  This specifies which match to return, where the first match is match= 1.  If a negative number is specified then a match is returned counting from the last match.  Hence match = -1 is the same as requesting the last match.  Defaults to 1.&lt;br /&gt;
; plain&lt;br /&gt;
: A flag indicating that the pattern should be understood as plain text.  Defaults to false.&lt;br /&gt;
; nomatch&lt;br /&gt;
: If no match is found, output the &amp;quot;nomatch&amp;quot; value rather than an error.&lt;br /&gt;
&lt;br /&gt;
If the match_number or start_index are out of range for the string being queried, then this function generates an error.  An error is also generated if no match is found.&lt;br /&gt;
If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.&lt;br /&gt;
&lt;br /&gt;
For information on constructing [[wikipedia:Lua (programming language)|Lua]] patterns, a form of [[wikipedia:regular expression|regular expression]], see:&lt;br /&gt;
&lt;br /&gt;
* [http://www.lua.org/manual/5.1/manual.html#5.4.1 Lua reference: Patterns] (as of version 5.1)&lt;br /&gt;
* [[mediawikiwiki:Extension:Scribunto/Lua_reference_manual#Patterns|Scribunto patterns]]&lt;br /&gt;
* [[mediawikiwiki:Extension:Scribunto/Lua_reference_manual#Ustring_patterns|Scribunto Unicode string patterns]]&lt;br /&gt;
&lt;br /&gt;
== pos ==&lt;br /&gt;
&lt;br /&gt;
This function returns a single character from the target string at position pos.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|pos|&amp;#039;&amp;#039;target_string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;index_value&amp;#039;&amp;#039;}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|pos|target= &amp;#039;&amp;#039;target_string&amp;#039;&amp;#039; |pos= &amp;#039;&amp;#039;index_value&amp;#039;&amp;#039; }}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; target&lt;br /&gt;
: The string to search&lt;br /&gt;
; pos&lt;br /&gt;
: The index for the character to return&lt;br /&gt;
&lt;br /&gt;
The first character has an index value of 1.&lt;br /&gt;
&lt;br /&gt;
If one requests a negative value, this function will select a character by counting backwards&lt;br /&gt;
from the end of the string.  In other words pos = -1 is the same as asking for the last character.&lt;br /&gt;
&lt;br /&gt;
A requested value of zero, or a value greater than the length of the string returns an error.&lt;br /&gt;
&lt;br /&gt;
== find ==&lt;br /&gt;
&lt;br /&gt;
This function allows one to search for a target string or pattern within another string.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|find|&amp;#039;&amp;#039;source_str&amp;#039;&amp;#039;|&amp;#039;&amp;#039;target_string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;start_index&amp;#039;&amp;#039;|&amp;#039;&amp;#039;plain_flag&amp;#039;&amp;#039;}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|find|source= &amp;#039;&amp;#039;source_str&amp;#039;&amp;#039; |target= &amp;#039;&amp;#039;target_str&amp;#039;&amp;#039; |start= &amp;#039;&amp;#039;start_index&amp;#039;&amp;#039;|plain= &amp;#039;&amp;#039;plain_flag&amp;#039;&amp;#039; }}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; source&lt;br /&gt;
: The string to search&lt;br /&gt;
; target&lt;br /&gt;
: The string or pattern to find within source&lt;br /&gt;
; start&lt;br /&gt;
: The index within the source string to start the search, defaults to 1&lt;br /&gt;
; plain&lt;br /&gt;
: Boolean flag indicating that target should be understood as plain text and not as a [[wikipedia:Lua (programming language)|Lua]]-style [[wikipedia:regular expression|regular expression]], defaults to true&lt;br /&gt;
&lt;br /&gt;
This function returns the first index &amp;gt;= &amp;quot;start&amp;quot; where &amp;quot;target&amp;quot; can be found within &amp;quot;source&amp;quot;.  Indices are 1-based.  If &amp;quot;target&amp;quot; is not found, then this function returns 0.  If either &amp;quot;source&amp;quot; or &amp;quot;target&amp;quot; are missing / empty, this function also returns 0.&lt;br /&gt;
&lt;br /&gt;
This function should be safe for UTF-8 strings.&lt;br /&gt;
&lt;br /&gt;
== replace ==&lt;br /&gt;
&lt;br /&gt;
This function allows one to replace a target string or pattern within another string.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|replace|&amp;#039;&amp;#039;source_str&amp;#039;&amp;#039;|&amp;#039;&amp;#039;pattern_string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;replace_string&amp;#039;&amp;#039;|&amp;#039;&amp;#039;replacement_count&amp;#039;&amp;#039;|&amp;#039;&amp;#039;plain_flag&amp;#039;&amp;#039;}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|replace|source= &amp;#039;&amp;#039;source_string&amp;#039;&amp;#039; |pattern= &amp;#039;&amp;#039;pattern_string&amp;#039;&amp;#039;|replace= &amp;#039;&amp;#039;replace_string&amp;#039;&amp;#039; |count= &amp;#039;&amp;#039;replacement_count&amp;#039;&amp;#039; |plain= &amp;#039;&amp;#039;plain_flag&amp;#039;&amp;#039; }}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; source&lt;br /&gt;
: The string to search&lt;br /&gt;
; pattern&lt;br /&gt;
: The string or pattern to find within source&lt;br /&gt;
; replace&lt;br /&gt;
: The replacement text&lt;br /&gt;
; count&lt;br /&gt;
: The number of occurrences to replace; defaults to all&lt;br /&gt;
; plain&lt;br /&gt;
: Boolean flag indicating that pattern should be understood as plain text and not as a [[mediawikiwiki:Extension:Scribunto/Lua reference manual#Ustring patterns|Scribunto ustring pattern]] (a unicode-friendly [[wikipedia:Lua (programming language)|Lua]]-style [[wikipedia:regular expression|regular expression]]); defaults to true&lt;br /&gt;
&lt;br /&gt;
== rep ==&lt;br /&gt;
&lt;br /&gt;
Repeats a string &amp;#039;&amp;#039;n&amp;#039;&amp;#039; times. A simple function to pipe string.rep to templates.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke: String|rep|&amp;#039;&amp;#039;source&amp;#039;&amp;#039;|&amp;#039;&amp;#039;count&amp;#039;&amp;#039;}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; source&lt;br /&gt;
: The string to repeat.&lt;br /&gt;
; count&lt;br /&gt;
: The number of repetitions.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{#invoke:String|rep|hello|3}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
gives&lt;br /&gt;
&lt;br /&gt;
{{#invoke:String|rep|hello|3}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Synced to starfinderwiki]]&lt;/div&gt;</summary>
		<author><name>PathfinderWiki&gt;Virenerus</name></author>
	</entry>
</feed>