<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Template%3AStr_mid%2Fdoc</id>
	<title>Template:Str mid/doc - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Template%3AStr_mid%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Template:Str_mid/doc&amp;action=history"/>
	<updated>2026-07-07T16:38:46Z</updated>
	<subtitle>在这个wiki上该页的修订历史</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=Template:Str_mid/doc&amp;diff=2973204&amp;oldid=prev</id>
		<title>imported&gt;A1Cafel 来自 2023年1月19日 (四) 05:25</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Template:Str_mid/doc&amp;diff=2973204&amp;oldid=prev"/>
		<updated>2023-01-19T05:25:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{lua|Module:String}}&lt;br /&gt;
{{High-use|all-pages=yes}}&lt;br /&gt;
&amp;lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
Characters in the source string are counted: the first is index {{code|1=1}}, the last one is index {{code|length of string}}. The substring requested can be defined by these two indexes. Also, the substring can be defined by one index, and the substring length. The options are:&lt;br /&gt;
&amp;lt;nowiki&amp;gt; {{str mid|&amp;lt;string&amp;gt;|&amp;lt;index of first character&amp;gt;|&amp;lt;length of substring&amp;gt;|&amp;lt;index of last character&amp;gt;}} &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
It returns a part of the &amp;lt;string&amp;gt;, starting with character on position &amp;#039;&amp;#039;index&amp;#039;&amp;#039;, length &amp;lt;sublength&amp;gt;, last character returned is end index.&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|5|3}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|5|3}}&lt;br /&gt;
&lt;br /&gt;
If parameter 2 is omitted, start is from character 1:&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz||5}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz||5}}&lt;br /&gt;
&lt;br /&gt;
If parameter 3 is omitted, the whole rest of the string is returned:&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|15}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|15}}&lt;br /&gt;
&lt;br /&gt;
=== Counting from the end ===&lt;br /&gt;
By entering a &amp;#039;&amp;#039;negative value&amp;#039;&amp;#039;, the index is counted &amp;#039;&amp;#039;from the end&amp;#039;&amp;#039;:&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|-7|4}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|-7|4}}&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|-7}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|-7}}&lt;br /&gt;
&lt;br /&gt;
=== Instead if substring length, use index for last character ===&lt;br /&gt;
By using parameter {{para|4|&amp;#039;&amp;#039;n&amp;#039;&amp;#039;}}, a number, you do not ask for substring length, but the last character (as counted from the start of the input string):&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|5||7}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|5||7}}&lt;br /&gt;
&lt;br /&gt;
===Spaces are kept===&lt;br /&gt;
In the returned substring, spaces are kept:&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;&amp;gt;{{str mid|I like this.|2|6}}&amp;lt;&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; &amp;gt;{{str mid|I like this,|2|6}}&amp;lt;&lt;br /&gt;
But the input string is trimmed:&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;&amp;gt;{{str mid|   I like this.   |2|6}}&amp;lt;&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; &amp;gt;{{str mid|   I like this.   |2|6}}&amp;lt;&lt;br /&gt;
&lt;br /&gt;
===Error messages===&lt;br /&gt;
When the ranges (either param2 or the substring length) is out impossible in the string, an error is returned:&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|30}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|30|ignore errors=false|no category=true}}&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|0|45}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|5|45|ignore errors=false|no category=true}}&lt;br /&gt;
The error can be suppressed by using {{para|ignore errors|true}}. A blank (empty string) will be returned:&lt;br /&gt;
*&amp;lt;nowiki&amp;gt;{{str mid|Abcdefghijklmnopqrstuvwxyz|0|45|ignore errors=true}}&amp;lt;/nowiki&amp;gt; &amp;amp;rarr; {{str mid|Abcdefghijklmnopqrstuvwxyz|5|45|ignore errors=true}}&lt;br /&gt;
&lt;br /&gt;
====Error category====&lt;br /&gt;
* {{para|no category|true}} switches off category adding.&lt;br /&gt;
* {{para|error category|&amp;lt;nowiki&amp;gt;[[Category:Your category name]]&amp;lt;/nowiki&amp;gt;}} sets the category to be added when in case of an error.&amp;lt;br/&amp;gt;&lt;br /&gt;
::Default is [[:Category:Errors reported by Module String]].&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
{{string-handling templates}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
&amp;lt;!-- CATEGORIES AND INTERWIKIS HERE, THANKS --&amp;gt;&lt;br /&gt;
[[Category:字符串處理模板|{{PAGENAME}}]]&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;A1Cafel</name></author>
	</entry>
</feed>