<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://addonstudio.org/mw1/index.php?action=history&amp;feed=atom&amp;title=WoW%3AUSERAPI_substr</id>
	<title>WoW:USERAPI substr - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://addonstudio.org/mw1/index.php?action=history&amp;feed=atom&amp;title=WoW%3AUSERAPI_substr"/>
	<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;action=history"/>
	<updated>2026-05-22T14:37:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17513&amp;oldid=prev</id>
		<title>Move page script: Move page script moved page USERAPI substr to WoW:USERAPI substr without leaving a redirect</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17513&amp;oldid=prev"/>
		<updated>2023-08-15T04:49:14Z</updated>

		<summary type="html">&lt;p&gt;Move page script moved page &lt;a href=&quot;/wiki/WoW:USERAPI_substr&quot; title=&quot;WoW:USERAPI substr&quot;&gt;USERAPI substr&lt;/a&gt; to &lt;a href=&quot;/wiki/WoW:USERAPI_substr&quot; title=&quot;WoW:USERAPI substr&quot;&gt;USERAPI substr&lt;/a&gt; without leaving a redirect&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 04:49, 15 August 2023&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>Move page script</name></author>
	</entry>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17512&amp;oldid=prev</id>
		<title>WoWWiki&gt;Charibot: catfix</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17512&amp;oldid=prev"/>
		<updated>2008-07-09T00:44:15Z</updated>

		<summary type="html">&lt;p&gt;catfix&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;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:44, 9 July 2008&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-l63&quot;&gt;Line 63:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 63:&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;__NOTOC__&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;__NOTOC__&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;[[Category:User &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Defined Functions&lt;/del&gt;]]&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;[[Category:User &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;defined functions&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WoWWiki&gt;Charibot</name></author>
	</entry>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17511&amp;oldid=prev</id>
		<title>WoWWiki&gt;Pcj at 16:37, 4 December 2007</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17511&amp;oldid=prev"/>
		<updated>2007-12-04T16:37:19Z</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;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:37, 4 December 2007&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-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&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;{{userfunc}} &amp;lt;!-- Leave this line in! --&amp;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;{{userfunc}} &amp;lt;!-- Leave this line in! --&amp;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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;center&gt;&#039;&#039;&#039;substr&#039;&#039;&#039; &#039;&#039;- by [[user:egingell|egingell]] -&#039;&#039;&amp;lt;/center&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;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;Imp [[API_strsub|strsub]]. Returns a string starting from &amp;#039;&amp;#039;start&amp;#039;&amp;#039; to &amp;#039;&amp;#039;length&amp;#039;&amp;#039; characters from &amp;#039;&amp;#039;start&amp;#039;&amp;#039; (identical to the [http://php.net/substr PHP function] of the same name).&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;Imp [[API_strsub|strsub]]. Returns a string starting from &amp;#039;&amp;#039;start&amp;#039;&amp;#039; to &amp;#039;&amp;#039;length&amp;#039;&amp;#039; characters from &amp;#039;&amp;#039;start&amp;#039;&amp;#039; (identical to the [http://php.net/substr PHP function] of the same name).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WoWWiki&gt;Pcj</name></author>
	</entry>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17510&amp;oldid=prev</id>
		<title>WoWWiki&gt;Egingell: New page: {{userfunc}} &lt;!-- Leave this line in! --&gt; &lt;center&gt;&#039;&#039;&#039;substr&#039;&#039;&#039; &#039;&#039;- by egingell -&#039;&#039;&lt;/center&gt;  Imp strsub. Returns a string starting from &#039;&#039;start&#039;&#039; to &#039;&#039;leng...</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:USERAPI_substr&amp;diff=17510&amp;oldid=prev"/>
		<updated>2007-09-30T12:58:28Z</updated>

		<summary type="html">&lt;p&gt;New page: {{userfunc}} &amp;lt;!-- Leave this line in! --&amp;gt; &amp;lt;center&amp;gt;&amp;#039;&amp;#039;&amp;#039;substr&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;- by &lt;a href=&quot;/mw1/index.php?title=User:Egingell&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:Egingell (page does not exist)&quot;&gt;egingell&lt;/a&gt; -&amp;#039;&amp;#039;&amp;lt;/center&amp;gt;  Imp &lt;a href=&quot;/wiki/WoW:API_strsub&quot; title=&quot;WoW:API strsub&quot;&gt;strsub&lt;/a&gt;. Returns a string starting from &amp;#039;&amp;#039;start&amp;#039;&amp;#039; to &amp;#039;&amp;#039;leng...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{userfunc}} &amp;lt;!-- Leave this line in! --&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;#039;&amp;#039;&amp;#039;substr&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;- by [[user:egingell|egingell]] -&amp;#039;&amp;#039;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imp [[API_strsub|strsub]]. Returns a string starting from &amp;#039;&amp;#039;start&amp;#039;&amp;#039; to &amp;#039;&amp;#039;length&amp;#039;&amp;#039; characters from &amp;#039;&amp;#039;start&amp;#039;&amp;#039; (identical to the [http://php.net/substr PHP function] of the same name).&lt;br /&gt;
&lt;br /&gt;
 string = &amp;#039;&amp;#039;&amp;amp;lt;PREFIX&amp;amp;gt;&amp;#039;&amp;#039;_substr(string, start [, length])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Function Parameters ==&lt;br /&gt;
=== Arguments ===&lt;br /&gt;
&lt;br /&gt;
:;string : String - The subject string.&lt;br /&gt;
:;start : Integer - Start here. 0 and 1 have the same effect. Negative values are acceptable.&lt;br /&gt;
:;length : Integer - Go this many characters and stop. Negative values are acceptable.&lt;br /&gt;
=== Returns ===&lt;br /&gt;
&lt;br /&gt;
:;string: The desired piece of the string. If the resulting string is less than 0 characters long (which can only exist in the Twilight Zone), &amp;#039;&amp;#039;false&amp;#039;&amp;#039; is returned.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
 string = &amp;#039;&amp;#039;&amp;amp;lt;PREFIX&amp;amp;gt;&amp;#039;&amp;#039;_substr(&amp;quot;World of Warcraft&amp;quot;, 2, 4)&lt;br /&gt;
 string = &amp;#039;&amp;#039;&amp;amp;lt;PREFIX&amp;amp;gt;&amp;#039;&amp;#039;_substr(&amp;quot;World of Warcraft&amp;quot;, -2, -4)&lt;br /&gt;
 string = &amp;#039;&amp;#039;&amp;amp;lt;PREFIX&amp;amp;gt;&amp;#039;&amp;#039;_substr(&amp;quot;World of Warcraft&amp;quot;, -2, 4)&lt;br /&gt;
 string = &amp;#039;&amp;#039;&amp;amp;lt;PREFIX&amp;amp;gt;&amp;#039;&amp;#039;_substr(&amp;quot;World of Warcraft&amp;quot;, -2, -1)&lt;br /&gt;
 string = &amp;#039;&amp;#039;&amp;amp;lt;PREFIX&amp;amp;gt;&amp;#039;&amp;#039;_substr(&amp;quot;World of Warcraft&amp;quot;, 4, -1)&lt;br /&gt;
&lt;br /&gt;
====Results====&lt;br /&gt;
 &amp;quot;orld&amp;quot;&lt;br /&gt;
 false -- error condition: the resulting string is negative in length and, therefore, cannot exist.&lt;br /&gt;
 &amp;quot;ft&amp;quot;&lt;br /&gt;
 &amp;quot;f&amp;quot;&lt;br /&gt;
 &amp;quot;ld of Warcraf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function &amp;amp;lt;PREFIX&amp;amp;gt;_substr(string, start, length)&lt;br /&gt;
    if not string then&lt;br /&gt;
        return &amp;#039;&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    -- Sanity checks: make sure integers are integers.&lt;br /&gt;
    start = floor(tonumber(start)) or 1&lt;br /&gt;
    if length == nil then&lt;br /&gt;
        length = strlen(string)&lt;br /&gt;
    end&lt;br /&gt;
    if length &amp;lt; 0 and start &amp;lt; 0 and abs(length) &amp;gt; abs(start) then&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
    if start &amp;lt; 0 then&lt;br /&gt;
        start = strlen(string) + (start + 1)&lt;br /&gt;
    end&lt;br /&gt;
    length = floor(tonumber(length))&lt;br /&gt;
    local String = &amp;#039;&amp;#039;&lt;br /&gt;
    if length &amp;gt;= 0 then&lt;br /&gt;
        String = strsub(string, start, (start - 1) + length)&lt;br /&gt;
    else&lt;br /&gt;
        String = string&lt;br /&gt;
        String = strsub(String, start)&lt;br /&gt;
        String = strsub(String, 1, strlen(String) + length)&lt;br /&gt;
    end&lt;br /&gt;
    return String&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
[[Category:User Defined Functions]]&lt;/div&gt;</summary>
		<author><name>WoWWiki&gt;Egingell</name></author>
	</entry>
</feed>