<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2Ftrappist_the_monk%2Fstrcmp</id>
	<title>Module:Sandbox/trappist the monk/strcmp - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2Ftrappist_the_monk%2Fstrcmp"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/trappist_the_monk/strcmp&amp;action=history"/>
	<updated>2026-07-31T16:04:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/trappist_the_monk/strcmp&amp;diff=146630&amp;oldid=prev</id>
		<title>imported&gt;Trappist the monk at 18:05, 7 June 2019</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/trappist_the_monk/strcmp&amp;diff=146630&amp;oldid=prev"/>
		<updated>2019-06-07T18:05:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--local function strcmp (str_a, str_b)&lt;br /&gt;
local function strcmp (frame)&lt;br /&gt;
	local str_a = frame.args[1];&lt;br /&gt;
	local str_b = frame.args[2];&lt;br /&gt;
&lt;br /&gt;
	str_a = str_a:gsub (&amp;#039;(%-%-templatestyles%-)%x+(%-)&amp;#039;, &amp;#039;%100000000%2&amp;#039;)&lt;br /&gt;
	str_b = str_b:gsub (&amp;#039;(%-%-templatestyles%-)%x+(%-)&amp;#039;, &amp;#039;%100000000%2&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	local result = {};&lt;br /&gt;
	&lt;br /&gt;
	local len_a = str_a:len();&lt;br /&gt;
	local len_b = str_b:len();&lt;br /&gt;
	&lt;br /&gt;
	local t_str_a = {}&lt;br /&gt;
	local t_str_b = {}&lt;br /&gt;
	&lt;br /&gt;
	local limit = len_a;														-- assume that both strings are same length&lt;br /&gt;
&lt;br /&gt;
	if len_a == len_b then&lt;br /&gt;
		if str_a == str_b then&lt;br /&gt;
			return &amp;#039;equal&amp;#039;;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (result, &amp;#039;length mismatch: a: &amp;#039; .. len_a .. &amp;#039;; b: &amp;#039; .. len_b);&lt;br /&gt;
		if len_a &amp;lt; len_b then&lt;br /&gt;
			limit = len_a;&lt;br /&gt;
		else&lt;br /&gt;
			limit = len_b;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for c in string.gmatch (str_a, &amp;#039;.&amp;#039;) do&lt;br /&gt;
		table.insert (t_str_a, c);&lt;br /&gt;
	end&lt;br /&gt;
	for c in str_b:gmatch (&amp;#039;.&amp;#039;) do&lt;br /&gt;
		table.insert (t_str_b, c);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local i = 1;&lt;br /&gt;
	while i &amp;lt; limit do&lt;br /&gt;
		if t_str_a[i] == t_str_b[i] then&lt;br /&gt;
			i = i + 1;															-- position of last equal character&lt;br /&gt;
		else&lt;br /&gt;
			break;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if len_a ~= len_b then														-- if length mismatch &lt;br /&gt;
		if not t_str_a[i] and t_str_b[i] or 									-- if one but not both are nil&lt;br /&gt;
			t_str_a[i] and not t_str_b[i] then&lt;br /&gt;
				i = i + 1;														-- point to last matching character&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if limit == i then															-- if we tested &amp;lt;limit&amp;gt; number of characters&lt;br /&gt;
		table.insert (result, &amp;#039;strings eq to position: &amp;#039; .. i);&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (result, &amp;#039;strings eq to position: &amp;#039; .. i .. &amp;#039;: &amp;#039; .. string.byte (t_str_a[i]) .. &amp;#039;(&amp;#039; .. t_str_a[i] .. &amp;#039;) ≠ &amp;#039; .. string.byte (t_str_b[i]) .. &amp;#039;(&amp;#039; .. t_str_b[i] .. &amp;#039;)&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return table.concat (result, &amp;#039;&amp;lt;br /&amp;gt;&amp;#039;);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {strcmp = strcmp}&lt;/div&gt;</summary>
		<author><name>imported&gt;Trappist the monk</name></author>
	</entry>
</feed>