<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hant-TW">
	<id>https://chunghwamc.com/wiki/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E7%B5%84%3A%E5%AD%97%E4%B8%B2</id>
	<title>模組:字串 - 修訂紀錄</title>
	<link rel="self" type="application/atom+xml" href="https://chunghwamc.com/wiki/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E7%B5%84%3A%E5%AD%97%E4%B8%B2"/>
	<link rel="alternate" type="text/html" href="https://chunghwamc.com/wiki/index.php?title=%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&amp;action=history"/>
	<updated>2026-04-05T19:38:54Z</updated>
	<subtitle>本 wiki 上此頁面的修訂紀錄</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://chunghwamc.com/wiki/index.php?title=%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&amp;diff=1748&amp;oldid=prev</id>
		<title>Chunghwamc：​Chunghwamc已移動頁面模組:String至模組:字串，不留重新導向</title>
		<link rel="alternate" type="text/html" href="https://chunghwamc.com/wiki/index.php?title=%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&amp;diff=1748&amp;oldid=prev"/>
		<updated>2025-02-26T13:16:05Z</updated>

		<summary type="html">&lt;p&gt;Chunghwamc已移動頁面&lt;a href=&quot;/wiki/index.php?title=%E6%A8%A1%E7%B5%84:String&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;模組:String（頁面不存在）&quot;&gt;模組:String&lt;/a&gt;至&lt;a href=&quot;/wiki/%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&quot; title=&quot;模組:字串&quot;&gt;模組:字串&lt;/a&gt;，不留重新導向&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hant-TW&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上個修訂&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;於 2025年2月26日 (三) 21:16 的修訂&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hant-TW&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（無差異）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key chmc_wiki:diff:1.41:old-1747:rev-1748 --&gt;
&lt;/table&gt;</summary>
		<author><name>Chunghwamc</name></author>
	</entry>
	<entry>
		<id>https://chunghwamc.com/wiki/index.php?title=%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&amp;diff=1747&amp;oldid=prev</id>
		<title>Chunghwamc 於 2025年2月26日 (三) 13:15</title>
		<link rel="alternate" type="text/html" href="https://chunghwamc.com/wiki/index.php?title=%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&amp;diff=1747&amp;oldid=prev"/>
		<updated>2025-02-26T13:15:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hant-TW&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上個修訂&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;於 2025年2月26日 (三) 21:15 的修訂&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l87&quot;&gt;第87行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第87行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if i &amp;gt; len or j &amp;gt; len or i &amp;lt; 1 or j &amp;lt; 1 then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if i &amp;gt; len or j &amp;gt; len or i &amp;lt; 1 or j &amp;lt; 1 then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;截取字符串索引脱离区间&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;擷取字串時超出範圍&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if j &amp;lt; i then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if j &amp;lt; i then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;截取字符串指示脱离顺序&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;擷取字串位置超出範圍&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l158&quot;&gt;第158行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第158行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if s == &amp;#039;&amp;#039; then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if s == &amp;#039;&amp;#039; then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;目标字符串是空的&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;目標字串是空的&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if pattern == &amp;#039;&amp;#039; then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if pattern == &amp;#039;&amp;#039; then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;模式字符串是空的&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;模式字串是空的&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if math.abs(start) &amp;lt; 1 or math.abs(start) &amp;gt; mw.ustring.len( s ) then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if math.abs(start) &amp;lt; 1 or math.abs(start) &amp;gt; mw.ustring.len( s ) then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;要求的起始点脱离区间&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;開始處超出範圍&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if match_index == 0 then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if match_index == 0 then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;匹配索引脱离区间&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;目標位置超出範圍&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if plain_flag then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if plain_flag then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l207&quot;&gt;第207行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第207行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if result == nil then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if result == nil then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         if nomatch == nil then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         if nomatch == nil then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;找不到匹配&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;找不到目標&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         else&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         else&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             return nomatch;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             return nomatch;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l247&quot;&gt;第247行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第247行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if pos == 0 or math.abs(pos) &amp;gt; mw.ustring.len( target_str ) then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if pos == 0 or math.abs(pos) &amp;gt; mw.ustring.len( target_str ) then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;字符串索引脱离区间&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         return str._error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;字串位置超出範圍&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end     &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end     &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l524&quot;&gt;第524行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第524行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function str._error( error_str )&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function str._error( error_str )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local frame = mw.getCurrentFrame();&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local frame = mw.getCurrentFrame();&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local error_category = frame.args.error_category or &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;字符串模块报告的错误&lt;/del&gt;&#039;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local error_category = frame.args.error_category or &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;字串模組產出的錯誤&lt;/ins&gt;&#039;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local ignore_errors = frame.args.ignore_errors or false;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local ignore_errors = frame.args.ignore_errors or false;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local no_category = frame.args.no_category or false;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local no_category = frame.args.no_category or false;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l532&quot;&gt;第532行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第532行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local error_str = &#039;&amp;lt;strong class=&quot;error&quot;&amp;gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;字符串模块出错：&lt;/del&gt;&#039; .. error_str .. &#039;&amp;lt;/strong&amp;gt;&#039;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local error_str = &#039;&amp;lt;strong class=&quot;error&quot;&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;字串模組出錯：&lt;/ins&gt;&#039; .. error_str .. &#039;&amp;lt;/strong&amp;gt;&#039;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if error_category ~= &amp;#039;&amp;#039; and not str._getBoolean( no_category ) then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     if error_category ~= &amp;#039;&amp;#039; and not str._getBoolean( no_category ) then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         error_str = &amp;#039;[[Category:&amp;#039; .. error_category .. &amp;#039;]]&amp;#039; .. error_str;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         error_str = &amp;#039;[[Category:&amp;#039; .. error_category .. &amp;#039;]]&amp;#039; .. error_str;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l557&quot;&gt;第557行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第557行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         boolean_value = boolean_str;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         boolean_value = boolean_str;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     else&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     else&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         error( &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;布尔值找不到&lt;/del&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         error( &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;找不到布林值&lt;/ins&gt;&#039; );&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end     &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     end     &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     return boolean_value&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     return boolean_value&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Chunghwamc</name></author>
	</entry>
	<entry>
		<id>https://chunghwamc.com/wiki/index.php?title=%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&amp;diff=141&amp;oldid=prev</id>
		<title>Chunghwamc：​建立內容為「--[[    This module is intended to provide access to basic string functions.  Most of the functions provided here can be invoked with named parameters,  unnamed parameters, or a mixture.  If named parameters are used, Mediawiki will  automatically remove any leading or trailing whitespace from the parameter.   Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.  Global options     ignore_errors: If set to &#039;true…」的新頁面</title>
		<link rel="alternate" type="text/html" href="https://chunghwamc.com/wiki/index.php?title=%E6%A8%A1%E7%B5%84:%E5%AD%97%E4%B8%B2&amp;diff=141&amp;oldid=prev"/>
		<updated>2024-03-23T14:40:54Z</updated>

		<summary type="html">&lt;p&gt;建立內容為「--[[    This module is intended to provide access to basic string functions.  Most of the functions provided here can be invoked with named parameters,  unnamed parameters, or a mixture.  If named parameters are used, Mediawiki will  automatically remove any leading or trailing whitespace from the parameter.   Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.  Global options     ignore_errors: If set to &amp;#039;true…」的新頁面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新頁面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[  &lt;br /&gt;
&lt;br /&gt;
This module is intended to provide access to basic string functions.&lt;br /&gt;
&lt;br /&gt;
Most of the functions provided here can be invoked with named parameters, &lt;br /&gt;
unnamed parameters, or a mixture.  If named parameters are used, Mediawiki will &lt;br /&gt;
automatically remove any leading or trailing whitespace from the parameter.  &lt;br /&gt;
Depending on the intended use, it may be advantageous to either preserve or&lt;br /&gt;
remove such whitespace.&lt;br /&gt;
&lt;br /&gt;
Global options&lt;br /&gt;
    ignore_errors: If set to &amp;#039;true&amp;#039; or 1, any error condition will result in &lt;br /&gt;
        an empty string being returned rather than an error message.  &lt;br /&gt;
        &lt;br /&gt;
    error_category: If an error occurs, specifies the name of a category to &lt;br /&gt;
        include with the error message.  The default category is  &lt;br /&gt;
        [Category:Errors reported by Module String].&lt;br /&gt;
        &lt;br /&gt;
    no_category: If set to &amp;#039;true&amp;#039; or 1, no category will be added if an error&lt;br /&gt;
        is generated.&lt;br /&gt;
        &lt;br /&gt;
Unit tests for this module are available at Module:String/tests.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local str = {}&lt;br /&gt;
&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;
{{#invoke:String|len|target_string|}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|len|s=target_string}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    s: The string whose length to report&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the target string.  &lt;br /&gt;
]]&lt;br /&gt;
function str.len( frame )&lt;br /&gt;
    local new_args = str._getParameters( frame.args, {&amp;#039;s&amp;#039;} );&lt;br /&gt;
    local s = new_args[&amp;#039;s&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    return mw.ustring.len( s )&lt;br /&gt;
end&lt;br /&gt;
&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;
{{#invoke:String|sub|target_string|start_index|end_index}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    s: The string to return a subset of&lt;br /&gt;
    i: The fist index of the substring to return, defaults to 1.&lt;br /&gt;
    j: 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 i or j&lt;br /&gt;
is a negative value, it is interpreted the same as selecting a character by &lt;br /&gt;
counting from the end of the string.  Hence, a value of -1 is the same as &lt;br /&gt;
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 &lt;br /&gt;
reported.&lt;br /&gt;
]]&lt;br /&gt;
function str.sub( frame )&lt;br /&gt;
    local new_args = str._getParameters( frame.args, { &amp;#039;s&amp;#039;, &amp;#039;i&amp;#039;, &amp;#039;j&amp;#039; } );&lt;br /&gt;
    local s = new_args[&amp;#039;s&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local i = tonumber( new_args[&amp;#039;i&amp;#039;] ) or 1;&lt;br /&gt;
    local j = tonumber( new_args[&amp;#039;j&amp;#039;] ) or -1;&lt;br /&gt;
    &lt;br /&gt;
    local len = mw.ustring.len( s );&lt;br /&gt;
&lt;br /&gt;
    -- Convert negatives for range checking&lt;br /&gt;
    if i &amp;lt; 0 then&lt;br /&gt;
        i = len + i + 1;&lt;br /&gt;
    end&lt;br /&gt;
    if j &amp;lt; 0 then&lt;br /&gt;
        j = len + j + 1;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if i &amp;gt; len or j &amp;gt; len or i &amp;lt; 1 or j &amp;lt; 1 then&lt;br /&gt;
        return str._error( &amp;#039;截取字符串索引脱离区间&amp;#039; );&lt;br /&gt;
    end&lt;br /&gt;
    if j &amp;lt; i then&lt;br /&gt;
        return str._error( &amp;#039;截取字符串指示脱离顺序&amp;#039; );&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return mw.ustring.sub( s, i, j )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
This function implements that features of {{str sub old}} and is kept in order&lt;br /&gt;
to maintain these older templates.&lt;br /&gt;
]]&lt;br /&gt;
function str.sublength( frame )&lt;br /&gt;
    local i = tonumber( frame.args.i ) or 0&lt;br /&gt;
    local len = tonumber( frame.args.len )&lt;br /&gt;
    return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )&lt;br /&gt;
end&lt;br /&gt;
&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 &lt;br /&gt;
specified pattern.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index&lt;br /&gt;
    |match=match_number|plain=plain_flag|nomatch=nomatch_output}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    s: The string to search&lt;br /&gt;
    pattern: The pattern or string to find within the string&lt;br /&gt;
    start: The index within the source string to start the search.  The first&lt;br /&gt;
        character of the string has index 1.  Defaults to 1.&lt;br /&gt;
    match: In some cases it may be possible to make multiple matches on a single &lt;br /&gt;
        string.  This specifies which match to return, where the first match is &lt;br /&gt;
        match= 1.  If a negative number is specified then a match is returned &lt;br /&gt;
        counting from the last match.  Hence match = -1 is the same as requesting&lt;br /&gt;
        the last match.  Defaults to 1.&lt;br /&gt;
    plain: A flag indicating that the pattern should be understood as plain&lt;br /&gt;
        text.  Defaults to false.&lt;br /&gt;
    nomatch: If no match is found, output the &amp;quot;nomatch&amp;quot; value rather than an error.&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from each string.  In some circumstances this is desirable, in &lt;br /&gt;
other cases one may want to preserve the whitespace.&lt;br /&gt;
&lt;br /&gt;
If the match_number or start_index are out of range for the string being queried, then&lt;br /&gt;
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 &lt;br /&gt;
an empty string will be returned on any failure.&lt;br /&gt;
&lt;br /&gt;
For information on constructing Lua patterns, a form of [regular expression], see:&lt;br /&gt;
&lt;br /&gt;
* http://www.lua.org/manual/5.1/manual.html#5.4.1&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns&lt;br /&gt;
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
function str.match( frame )&lt;br /&gt;
    local new_args = str._getParameters( frame.args, {&amp;#039;s&amp;#039;, &amp;#039;pattern&amp;#039;, &amp;#039;start&amp;#039;, &amp;#039;match&amp;#039;, &amp;#039;plain&amp;#039;, &amp;#039;nomatch&amp;#039;} );&lt;br /&gt;
    local s = new_args[&amp;#039;s&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local start = tonumber( new_args[&amp;#039;start&amp;#039;] ) or 1;&lt;br /&gt;
    local plain_flag = str._getBoolean( new_args[&amp;#039;plain&amp;#039;] or false );&lt;br /&gt;
    local pattern = new_args[&amp;#039;pattern&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local match_index = math.floor( tonumber(new_args[&amp;#039;match&amp;#039;]) or 1 );&lt;br /&gt;
    local nomatch = new_args[&amp;#039;nomatch&amp;#039;];&lt;br /&gt;
    &lt;br /&gt;
    if s == &amp;#039;&amp;#039; then&lt;br /&gt;
        return str._error( &amp;#039;目标字符串是空的&amp;#039; );&lt;br /&gt;
    end&lt;br /&gt;
    if pattern == &amp;#039;&amp;#039; then&lt;br /&gt;
        return str._error( &amp;#039;模式字符串是空的&amp;#039; );&lt;br /&gt;
    end&lt;br /&gt;
    if math.abs(start) &amp;lt; 1 or math.abs(start) &amp;gt; mw.ustring.len( s ) then&lt;br /&gt;
        return str._error( &amp;#039;要求的起始点脱离区间&amp;#039; );&lt;br /&gt;
    end&lt;br /&gt;
    if match_index == 0 then&lt;br /&gt;
        return str._error( &amp;#039;匹配索引脱离区间&amp;#039; );&lt;br /&gt;
    end&lt;br /&gt;
    if plain_flag then&lt;br /&gt;
        pattern = str._escapePattern( pattern );&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local result&lt;br /&gt;
    if match_index == 1 then&lt;br /&gt;
        -- Find first match is simple case&lt;br /&gt;
        result = mw.ustring.match( s, pattern, start )&lt;br /&gt;
    else&lt;br /&gt;
        if start &amp;gt; 1 then&lt;br /&gt;
            s = mw.ustring.sub( s, start );&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        local iterator = mw.ustring.gmatch(s, pattern);&lt;br /&gt;
        if match_index &amp;gt; 0 then&lt;br /&gt;
            -- Forward search&lt;br /&gt;
            for w in iterator do&lt;br /&gt;
                match_index = match_index - 1;&lt;br /&gt;
                if match_index == 0 then&lt;br /&gt;
                    result = w;&lt;br /&gt;
                    break;&lt;br /&gt;
                end&lt;br /&gt;
            end    &lt;br /&gt;
        else&lt;br /&gt;
            -- Reverse search&lt;br /&gt;
            local result_table = {};&lt;br /&gt;
            local count = 1;&lt;br /&gt;
            for w in iterator do&lt;br /&gt;
                result_table[count] = w;&lt;br /&gt;
                count = count + 1;&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            result = result_table[ count + match_index ];            &lt;br /&gt;
        end&lt;br /&gt;
    end        &lt;br /&gt;
    &lt;br /&gt;
    if result == nil then&lt;br /&gt;
        if nomatch == nil then&lt;br /&gt;
            return str._error( &amp;#039;找不到匹配&amp;#039; );&lt;br /&gt;
        else&lt;br /&gt;
            return nomatch;&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        return result;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&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;
{{#invoke:String|pos|target_string|index_value}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|pos|target=target_string|pos=index_value}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    target: The string to search&lt;br /&gt;
    pos: The index for the character to return&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the target string.  In some circumstances this is desirable, in &lt;br /&gt;
other cases one may want to preserve the whitespace.&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;
function str.pos( frame )&lt;br /&gt;
    local new_args = str._getParameters( frame.args, {&amp;#039;target&amp;#039;, &amp;#039;pos&amp;#039;} );&lt;br /&gt;
    local target_str = new_args[&amp;#039;target&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local pos = tonumber( new_args[&amp;#039;pos&amp;#039;] ) or 0;&lt;br /&gt;
&lt;br /&gt;
    if pos == 0 or math.abs(pos) &amp;gt; mw.ustring.len( target_str ) then&lt;br /&gt;
        return str._error( &amp;#039;字符串索引脱离区间&amp;#039; );&lt;br /&gt;
    end    &lt;br /&gt;
    &lt;br /&gt;
    return mw.ustring.sub( target_str, pos, pos );&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
str_find&lt;br /&gt;
&lt;br /&gt;
This function duplicates the behavior of {{str_find}}, including all of its quirks.&lt;br /&gt;
This is provided in order to support existing templates, but is NOT RECOMMENDED for &lt;br /&gt;
new code and templates.  New code is recommended to use the &amp;quot;find&amp;quot; function instead.&lt;br /&gt;
&lt;br /&gt;
Returns the first index in &amp;quot;source&amp;quot; that is a match to &amp;quot;target&amp;quot;.  Indexing is 1-based,&lt;br /&gt;
and the function returns -1 if the &amp;quot;target&amp;quot; string is not present in &amp;quot;source&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Important Note: If the &amp;quot;target&amp;quot; string is empty / missing, this function returns a&lt;br /&gt;
value of &amp;quot;1&amp;quot;, which is generally unexpected behavior, and must be accounted for&lt;br /&gt;
separatetly.&lt;br /&gt;
]]&lt;br /&gt;
function str.str_find( frame )&lt;br /&gt;
    local new_args = str._getParameters( frame.args, {&amp;#039;source&amp;#039;, &amp;#039;target&amp;#039;} );&lt;br /&gt;
    local source_str = new_args[&amp;#039;source&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local target_str = new_args[&amp;#039;target&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
    if target_str == &amp;#039;&amp;#039; then&lt;br /&gt;
        return 1;&lt;br /&gt;
    end    &lt;br /&gt;
    &lt;br /&gt;
    local start = mw.ustring.find( source_str, target_str, 1, true )&lt;br /&gt;
    if start == nil then&lt;br /&gt;
        start = -1&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return start&lt;br /&gt;
end&lt;br /&gt;
&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&lt;br /&gt;
string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    source: The string to search&lt;br /&gt;
    target: The string or pattern to find within source&lt;br /&gt;
    start: The index within the source string to start the search, defaults to 1&lt;br /&gt;
    plain: Boolean flag indicating that target should be understood as plain&lt;br /&gt;
        text and not as a Lua style regular expression, defaults to true&lt;br /&gt;
&lt;br /&gt;
If invoked using named parameters, Mediawiki will automatically remove any leading or&lt;br /&gt;
trailing whitespace from the parameter.  In some circumstances this is desirable, in &lt;br /&gt;
other cases one may want to preserve the whitespace.&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 &lt;br /&gt;
within &amp;quot;source&amp;quot;.  Indices are 1-based.  If &amp;quot;target&amp;quot; is not found, then this &lt;br /&gt;
function returns 0.  If either &amp;quot;source&amp;quot; or &amp;quot;target&amp;quot; are missing / empty, this&lt;br /&gt;
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;
function str.find( frame )&lt;br /&gt;
    local new_args = str._getParameters( frame.args, {&amp;#039;source&amp;#039;, &amp;#039;target&amp;#039;, &amp;#039;start&amp;#039;, &amp;#039;plain&amp;#039; } ); &lt;br /&gt;
    local source_str = new_args[&amp;#039;source&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local pattern = new_args[&amp;#039;target&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local start_pos = tonumber(new_args[&amp;#039;start&amp;#039;]) or 1;&lt;br /&gt;
    local plain = new_args[&amp;#039;plain&amp;#039;] or true;&lt;br /&gt;
        &lt;br /&gt;
    if source_str == &amp;#039;&amp;#039; or pattern == &amp;#039;&amp;#039; then&lt;br /&gt;
        return 0;&lt;br /&gt;
    end    &lt;br /&gt;
    &lt;br /&gt;
    plain = str._getBoolean( plain );&lt;br /&gt;
&lt;br /&gt;
    local start = mw.ustring.find( source_str, pattern, start_pos, plain )&lt;br /&gt;
    if start == nil then&lt;br /&gt;
        start = 0&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return start&lt;br /&gt;
end&lt;br /&gt;
&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&lt;br /&gt;
string.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}&lt;br /&gt;
OR&lt;br /&gt;
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|&lt;br /&gt;
   count=replacement_count|plain=plain_flag}}&lt;br /&gt;
&lt;br /&gt;
Parameters&lt;br /&gt;
    source: The string to search&lt;br /&gt;
    pattern: The string or pattern to find within source&lt;br /&gt;
    replace: The replacement text&lt;br /&gt;
    count: The number of occurences to replace, defaults to all.&lt;br /&gt;
    plain: Boolean flag indicating that pattern should be understood as plain&lt;br /&gt;
        text and not as a Lua style regular expression, defaults to true &lt;br /&gt;
]]&lt;br /&gt;
function str.replace( frame )&lt;br /&gt;
    local new_args = str._getParameters( frame.args, {&amp;#039;source&amp;#039;, &amp;#039;pattern&amp;#039;, &amp;#039;replace&amp;#039;, &amp;#039;count&amp;#039;, &amp;#039;plain&amp;#039; } ); &lt;br /&gt;
    local source_str = new_args[&amp;#039;source&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local pattern = new_args[&amp;#039;pattern&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local replace = new_args[&amp;#039;replace&amp;#039;] or &amp;#039;&amp;#039;;&lt;br /&gt;
    local count = tonumber( new_args[&amp;#039;count&amp;#039;] );&lt;br /&gt;
    local plain = new_args[&amp;#039;plain&amp;#039;] or true;&lt;br /&gt;
        &lt;br /&gt;
    if source_str == &amp;#039;&amp;#039; or pattern == &amp;#039;&amp;#039; then&lt;br /&gt;
        return source_str;&lt;br /&gt;
    end    &lt;br /&gt;
    plain = str._getBoolean( plain );&lt;br /&gt;
&lt;br /&gt;
    if plain then&lt;br /&gt;
        pattern = str._escapePattern( pattern );&lt;br /&gt;
        replace = mw.ustring.gsub( replace, &amp;quot;%%&amp;quot;, &amp;quot;%%%%&amp;quot; ); --Only need to escape replacement sequences.&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local result;&lt;br /&gt;
&lt;br /&gt;
    if count ~= nil then&lt;br /&gt;
        result = mw.ustring.gsub( source_str, pattern, replace, count );&lt;br /&gt;
    else&lt;br /&gt;
        result = mw.ustring.gsub( source_str, pattern, replace );&lt;br /&gt;
    end        &lt;br /&gt;
&lt;br /&gt;
    return result;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ &lt;br /&gt;
    simple function to pipe string.rep to templates.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function str.rep( frame )&lt;br /&gt;
    local repetitions = tonumber( frame.args[2] )&lt;br /&gt;
    if not repetitions then &lt;br /&gt;
        return str._error( &amp;#039;function rep expects a number as second parameter, received &amp;quot;&amp;#039; .. ( frame.args[2] or &amp;#039;&amp;#039; ) .. &amp;#039;&amp;quot;&amp;#039; )&lt;br /&gt;
    end&lt;br /&gt;
    return string.rep( frame.args[1] or &amp;#039;&amp;#039;, repetitions )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function str.split(inputstr, sep, no_pattern, ignore_null)&lt;br /&gt;
	--#invoke 支援&lt;br /&gt;
	if type(inputstr) == type({table}) then&lt;br /&gt;
		if not getArgs then getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs end&lt;br /&gt;
		args = getArgs(inputstr, {parentFirst=true})&lt;br /&gt;
		for arg_name, arg_value in pairs( args ) do&lt;br /&gt;
			if arg_name == 1 or arg_name == &amp;#039;1&amp;#039; or arg_name == &amp;quot;str&amp;quot; or arg_name == &amp;quot;inputstr&amp;quot; or arg_name == &amp;quot;input&amp;quot; then&lt;br /&gt;
				input_str = arg_value&lt;br /&gt;
			elseif arg_name == 2 or arg_name == &amp;#039;2&amp;#039; or arg_name == &amp;quot;sep&amp;quot; or arg_name == &amp;quot;separator&amp;quot; then&lt;br /&gt;
				separ = arg_value&lt;br /&gt;
			elseif arg_name == 3 or arg_name == &amp;#039;3&amp;#039; or arg_name == &amp;quot;no_pattern&amp;quot; or arg_name == &amp;quot;no pattern&amp;quot; then&lt;br /&gt;
				no_pattern_flag = arg_value&lt;br /&gt;
			elseif arg_name == 4 or arg_name == &amp;#039;4&amp;#039; or arg_name == &amp;quot;ignore_null&amp;quot; or arg_name == &amp;quot;ignore null&amp;quot; then&lt;br /&gt;
				ignore_null_flag = arg_value&lt;br /&gt;
			elseif arg_name == 5 or arg_name == &amp;#039;5&amp;#039; or arg_name == &amp;quot;format&amp;quot; then&lt;br /&gt;
				format = arg_value or &amp;quot;*{{{1}}}\n&amp;quot;;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if not yesno then yesno = require(&amp;#039;Module:Yesno&amp;#039;) end&lt;br /&gt;
		no_pattern_flag = yesno( no_pattern_flag or &amp;#039;yes&amp;#039; )&lt;br /&gt;
		ignore_null_flag = yesno( ignore_null_flag or &amp;#039;no&amp;#039; )&lt;br /&gt;
		is_invoke = true&lt;br /&gt;
		format = mw.ustring.gsub(format or &amp;quot;*{{{1}}}\n&amp;quot;, &amp;quot;%{%{%{.-%}%}%}&amp;quot;, &amp;quot;%%s&amp;quot; );&lt;br /&gt;
		it = mw.ustring.find(format, &amp;quot;%%s&amp;quot;, 1)&lt;br /&gt;
		if it == nil then format = format .. &amp;quot;%s&amp;quot; end&lt;br /&gt;
		format = mw.ustring.gsub(format, &amp;quot;\\n&amp;quot;, &amp;quot;\n&amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
		input_str = inputstr&lt;br /&gt;
		separ = sep&lt;br /&gt;
		no_pattern_flag = no_pattern&lt;br /&gt;
		ignore_null_flag = ignore_null&lt;br /&gt;
		is_invoke = false&lt;br /&gt;
	end&lt;br /&gt;
	input_str = input_str or &amp;#039;&amp;#039; &lt;br /&gt;
	separ = separ or &amp;quot;%s&amp;quot;&lt;br /&gt;
	if no_pattern_flag == nil then no_pattern_flag = true end&lt;br /&gt;
	if ignore_null_flag == nil then ignore_null_flag = false end&lt;br /&gt;
&lt;br /&gt;
	length = mw.ustring.len(input_str)&lt;br /&gt;
	--split函數起點&lt;br /&gt;
	if no_pattern_flag then&lt;br /&gt;
		separ = mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(separ, &lt;br /&gt;
			&amp;quot;%[&amp;quot;, &amp;quot;%[&amp;quot;), &amp;quot;%]&amp;quot;, &amp;quot;%]&amp;quot;), &amp;quot;%{&amp;quot;, &amp;quot;%{&amp;quot;), &amp;quot;%}&amp;quot;, &amp;quot;%}&amp;quot;), &amp;quot;%%&amp;quot;, &amp;quot;%%%%&amp;quot;), &amp;quot;%)&amp;quot;, &amp;quot;%)&amp;quot;), &amp;quot;%-&amp;quot;, &amp;quot;%-&amp;quot;),&lt;br /&gt;
			&amp;quot;%^&amp;quot;, &amp;quot;%^&amp;quot;), &amp;quot;%$&amp;quot;, &amp;quot;%$&amp;quot;), &amp;quot;%(&amp;quot;, &amp;quot;%(&amp;quot;), &amp;quot;%.&amp;quot;, &amp;quot;%.&amp;quot;), &amp;quot;%*&amp;quot;, &amp;quot;%*&amp;quot;), &amp;quot;%+&amp;quot;, &amp;quot;%+&amp;quot;), &amp;quot;%|&amp;quot;, &amp;quot;%|&amp;quot;);&lt;br /&gt;
	end&lt;br /&gt;
	iterator = 1 ; i = 1 ; flag = true&lt;br /&gt;
	result = {}&lt;br /&gt;
	separ_str_begin, separ_str_end = mw.ustring.find(input_str, separ, iterator)&lt;br /&gt;
	--&lt;br /&gt;
	debug1 = 1&lt;br /&gt;
	--&lt;br /&gt;
	while flag do&lt;br /&gt;
		debug1 = debug1 + 1&lt;br /&gt;
		if separ_str_begin == nil or iterator &amp;gt; length or debug1 &amp;gt;= 100 then&lt;br /&gt;
			separ_str_begin = 0&lt;br /&gt;
			separ_str_end = -2&lt;br /&gt;
			flag = false&lt;br /&gt;
		end&lt;br /&gt;
		if separ_str_end &amp;lt; separ_str_begin then separ_str_end = separ_str_begin end&lt;br /&gt;
		finded_str = mw.ustring.sub(input_str, iterator, separ_str_begin - 1)&lt;br /&gt;
		if not(mw.text.trim(finded_str) == &amp;#039;&amp;#039; and ignore_null_flag) then&lt;br /&gt;
			result[i] = finded_str&lt;br /&gt;
			i = i + 1&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		iterator = separ_str_end + 1&lt;br /&gt;
		separ_str_begin, separ_str_end = mw.ustring.find(input_str, separ, iterator)&lt;br /&gt;
	end&lt;br /&gt;
	if is_invoke then&lt;br /&gt;
		body = &amp;#039;&amp;#039;&lt;br /&gt;
		for i, result_str in pairs( result ) do&lt;br /&gt;
			body = body .. mw.ustring.gsub(format, &amp;quot;%%s&amp;quot;, result_str)&lt;br /&gt;
		end&lt;br /&gt;
		return body&lt;br /&gt;
	end&lt;br /&gt;
	return result;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
join&lt;br /&gt;
&lt;br /&gt;
Join all non empty arguments together; the first argument is the separator.&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:String|join|sep|one|two|three}}&lt;br /&gt;
]]&lt;br /&gt;
function str.join(frame)&lt;br /&gt;
	local args = {}&lt;br /&gt;
	local sep&lt;br /&gt;
	for _, v in ipairs( frame.args ) do&lt;br /&gt;
		if sep then&lt;br /&gt;
			if v ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				table.insert(args, v)&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			sep = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat( args, sep or &amp;#039;&amp;#039; )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function that populates the argument list given that user may need to use a mix of&lt;br /&gt;
named and unnamed parameters.  This is relevant because named parameters are not&lt;br /&gt;
identical to unnamed parameters due to string trimming, and when dealing with strings&lt;br /&gt;
we sometimes want to either preserve or remove that whitespace depending on the application.&lt;br /&gt;
]]&lt;br /&gt;
function str._getParameters( frame_args, arg_list )&lt;br /&gt;
    local new_args = {};&lt;br /&gt;
    local index = 1;&lt;br /&gt;
    local value;&lt;br /&gt;
    &lt;br /&gt;
    for i,arg in ipairs( arg_list ) do&lt;br /&gt;
        value = frame_args[arg]&lt;br /&gt;
        if value == nil then&lt;br /&gt;
            value = frame_args[index];&lt;br /&gt;
            index = index + 1;&lt;br /&gt;
        end&lt;br /&gt;
        new_args[arg] = value;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return new_args;&lt;br /&gt;
end        &lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function to handle error messages.&lt;br /&gt;
]]&lt;br /&gt;
function str._error( error_str )&lt;br /&gt;
    local frame = mw.getCurrentFrame();&lt;br /&gt;
    local error_category = frame.args.error_category or &amp;#039;字符串模块报告的错误&amp;#039;;&lt;br /&gt;
    local ignore_errors = frame.args.ignore_errors or false;&lt;br /&gt;
    local no_category = frame.args.no_category or false;&lt;br /&gt;
    &lt;br /&gt;
    if str._getBoolean(ignore_errors) then&lt;br /&gt;
        return &amp;#039;&amp;#039;;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local error_str = &amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;字符串模块出错：&amp;#039; .. error_str .. &amp;#039;&amp;lt;/strong&amp;gt;&amp;#039;;&lt;br /&gt;
    if error_category ~= &amp;#039;&amp;#039; and not str._getBoolean( no_category ) then&lt;br /&gt;
        error_str = &amp;#039;[[Category:&amp;#039; .. error_category .. &amp;#039;]]&amp;#039; .. error_str;&lt;br /&gt;
    end        &lt;br /&gt;
    &lt;br /&gt;
    return error_str;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper Function to interpret boolean strings&lt;br /&gt;
]]&lt;br /&gt;
function str._getBoolean( boolean_str )&lt;br /&gt;
    local boolean_value;&lt;br /&gt;
    &lt;br /&gt;
    if type( boolean_str ) == &amp;#039;string&amp;#039; then&lt;br /&gt;
        boolean_str = boolean_str:lower();&lt;br /&gt;
        if boolean_str == &amp;#039;false&amp;#039; or boolean_str == &amp;#039;no&amp;#039; or boolean_str == &amp;#039;0&amp;#039; &lt;br /&gt;
                or boolean_str == &amp;#039;&amp;#039; then&lt;br /&gt;
            boolean_value = false;&lt;br /&gt;
        else&lt;br /&gt;
            boolean_value = true;&lt;br /&gt;
        end    &lt;br /&gt;
    elseif type( boolean_str ) == &amp;#039;boolean&amp;#039; then&lt;br /&gt;
        boolean_value = boolean_str;&lt;br /&gt;
    else&lt;br /&gt;
        error( &amp;#039;布尔值找不到&amp;#039; );&lt;br /&gt;
    end    &lt;br /&gt;
    return boolean_value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Helper function that escapes all pattern characters so that they will be treated &lt;br /&gt;
as plain text.&lt;br /&gt;
]]&lt;br /&gt;
function str._escapePattern( pattern_str )&lt;br /&gt;
    return mw.ustring.gsub( pattern_str, &amp;quot;([%(%)%.%%%+%-%*%?%[%^%$%]])&amp;quot;, &amp;quot;%%%1&amp;quot; );&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return str&lt;/div&gt;</summary>
		<author><name>Chunghwamc</name></author>
	</entry>
</feed>