<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://amaranth-legacy.community/Template:String_split/doc?action=history&amp;feed=atom</id>
	<title>Template:String split/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://amaranth-legacy.community/Template:String_split/doc?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://amaranth-legacy.community/Template:String_split/doc?action=history"/>
	<updated>2026-04-09T20:24:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://amaranth-legacy.community/index.php?title=Template:String_split/doc&amp;diff=151083&amp;oldid=prev</id>
		<title>LordSkorne7: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://amaranth-legacy.community/index.php?title=Template:String_split/doc&amp;diff=151083&amp;oldid=prev"/>
		<updated>2025-04-16T06:58:30Z</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 06:58, April 16, 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>LordSkorne7</name></author>
	</entry>
	<entry>
		<id>https://amaranth-legacy.community/index.php?title=Template:String_split/doc&amp;diff=151082&amp;oldid=prev</id>
		<title>wikipedia&gt;Mifield: add high-use template</title>
		<link rel="alternate" type="text/html" href="https://amaranth-legacy.community/index.php?title=Template:String_split/doc&amp;diff=151082&amp;oldid=prev"/>
		<updated>2023-05-21T00:20:11Z</updated>

		<summary type="html">&lt;p&gt;add high-use template&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{high-use}}&lt;br /&gt;
{{Documentation subpage}}&lt;br /&gt;
{{Lua|Module:String2}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
[[Template:String split]] is a convenience wrapper for the &amp;lt;code&amp;gt;split&amp;lt;/code&amp;gt; function in [[Module:String2]].&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;split&amp;lt;/code&amp;gt; function splits text at boundaries specified by separator and returns the chunk for the index idx (starting at 1). It can use positional parameters or named parameters (but these should not be mixed):&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String2 |split |text |separator |index |true/false}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:String2 |split |txt=text |sep=separator |idx=index |plain=true/false}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
Any double quotes (&amp;quot;) in the separator parameter are stripped out, which allows spaces and wikitext like &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[&amp;quot;[&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to be passed. Use &amp;lt;code&amp;gt;{{tl|!}}&amp;lt;/code&amp;gt; for the pipe character &amp;lt;code&amp;gt;|&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the optional plain parameter is set to &amp;lt;code&amp;gt;false / no / 0&amp;lt;/code&amp;gt; then separator is treated as a [[mw:Extension:Scribunto/Lua reference manual#Patterns|Lua pattern]]. The default is plain=true, i.e. normal text matching.&lt;br /&gt;
&lt;br /&gt;
The index parameter is optional; it defaults to the first chunk of text. A negative parameter value counts chunks backward from the end of the text.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |This is a piece of text to be split |&amp;quot; &amp;quot;}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |This is a piece of text to be split |&amp;quot; &amp;quot;}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |This is a piece of text to be split |&amp;quot; &amp;quot;| 4}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |This is a piece of text to be split |&amp;quot; &amp;quot;| 4}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |This is a piece of text to be split |x| 2}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |This is a piece of text to be split |x| 2}}&lt;br /&gt;
Modules may return strings with | as separators like this: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:carousel | main | name = WPDogs | switchsecs = 5 }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{#invoke:carousel | main | name = WPDogs | switchsecs = 5 }}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |{{#invoke:carousel | main | name = WPDogs | switchsecs = 5 }}|{{!}}| 2}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |{{#invoke:carousel | main | name = WPDogs | switchsecs = 5 }}|{{!}}| 2}}&lt;br /&gt;
[[mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]] can allow splitting at classes of characters such as punctuation:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |Apples, pears, oranges; Cats, dogs|&amp;quot;%p&amp;quot;| 2 |false}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |Apples, pears, oranges; Cats, dogs|&amp;quot;%p&amp;quot;| 2 |false}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |Apples, pears, oranges; Cats, dogs|&amp;quot;%p&amp;quot;| 4 |false}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |Apples, pears, oranges; Cats, dogs|&amp;quot;%p&amp;quot;| 4 |false}}&lt;br /&gt;
Or split on anything that isn&amp;#039;t a letter (no is treated as false):&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |Apples pears oranges;  Cats  dogs|&amp;quot;%A+&amp;quot;| 4 |no}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |Apples pears oranges;  Cats  dogs|&amp;quot;%A+&amp;quot;| 4 |no}}&lt;br /&gt;
Named parameters force the trimming of leading and trailing spaces in the parameters and are generally clearer when used:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split | txt=Apples pears oranges;  Cats  dogs | sep=&amp;quot;%A+&amp;quot; | idx=3 | plain=false }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit | txt=Apples pears oranges;  Cats  dogs | sep=&amp;quot;%A+&amp;quot; | idx=3 | plain=false }}&lt;br /&gt;
A negative index will count back from the end of the text:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |txt=This is a piece of text to be split |sep=&amp;quot; &amp;quot; |idx=-1}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |txt=This is a piece of text to be split |sep=&amp;quot; &amp;quot; |idx=-1}}&lt;br /&gt;
An easy mistake to make when using negative parameters is to forget that a trailing space in the text when passed as an unnamed parameter will induce an empty last chunk:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |This is a piece of text to be split |&amp;quot; &amp;quot;|-1}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |This is a piece of text to be split |&amp;quot; &amp;quot;|-1}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{String split |This is a piece of text to be split|&amp;quot; &amp;quot;|-1}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{Stringsplit |This is a piece of text to be split|&amp;quot; &amp;quot;|-1}}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{String-handling templates}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:String manipulation templates]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Mifield</name></author>
	</entry>
</feed>