<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://4apedia.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AString2</id>
	<title>Module:String2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://4apedia.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AString2"/>
	<link rel="alternate" type="text/html" href="https://4apedia.com/index.php?title=Module:String2&amp;action=history"/>
	<updated>2026-05-15T12:34:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://4apedia.com/index.php?title=Module:String2&amp;diff=1209&amp;oldid=prev</id>
		<title>Amycjgrace: Created page with &quot;local p = {}  p.upper = function(frame) 	local s = mw.text.trim(frame.args[1] or &quot;&quot;) 	return string.upper(s) end  p.lower = function(frame) 	local s = mw.text.trim(frame.args[...&quot;</title>
		<link rel="alternate" type="text/html" href="https://4apedia.com/index.php?title=Module:String2&amp;diff=1209&amp;oldid=prev"/>
		<updated>2018-07-24T21:46:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  p.upper = function(frame) 	local s = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;) 	return string.upper(s) end  p.lower = function(frame) 	local s = mw.text.trim(frame.args[...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
p.upper = function(frame)&lt;br /&gt;
	local s = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	return string.upper(s)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.lower = function(frame)&lt;br /&gt;
	local s = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	return string.lower(s)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.sentence = function (frame )&lt;br /&gt;
	frame.args[1] = string.lower(frame.args[1])&lt;br /&gt;
	return p.ucfirst(frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.ucfirst = function (frame )&lt;br /&gt;
	local s =  mw.text.trim( frame.args[1] or &amp;quot;&amp;quot; )&lt;br /&gt;
	local s1 = &amp;quot;&amp;quot;&lt;br /&gt;
	-- if it's a list chop off and (store as s1) everything up to the first &amp;lt;li&amp;gt;&lt;br /&gt;
	local lipos = string.find(s, &amp;quot;&amp;lt;li&amp;gt;&amp;quot; )&lt;br /&gt;
	if lipos then&lt;br /&gt;
		s1 = string.sub(s, 1, lipos + 3)&lt;br /&gt;
		s = string.sub(s, lipos + 4)&lt;br /&gt;
	end&lt;br /&gt;
	-- s1 is either &amp;quot;&amp;quot; or the first part of the list markup, so we can continue&lt;br /&gt;
	-- and prepend s1 to the returned string&lt;br /&gt;
	if string.find(s, &amp;quot;^%[%[[^|]+|[^%]]+%]%]&amp;quot;) then&lt;br /&gt;
		-- this is a piped wikilink, so we capitalise the text, not the pipe&lt;br /&gt;
		local b, c = string.find(s, &amp;quot;|%A*%a&amp;quot;) -- find the first letter after the pipe&lt;br /&gt;
		return s1 .. string.sub(s, 1, c-1) .. string.upper(string.sub(s, c, c)) .. string.sub(s, c+1)&lt;br /&gt;
	end&lt;br /&gt;
	local letterpos = string.find(s, '%a')&lt;br /&gt;
	if letterpos then&lt;br /&gt;
		local first = string.sub(s, 1, letterpos - 1)&lt;br /&gt;
		local letter = string.sub(s, letterpos, letterpos)&lt;br /&gt;
		local rest = string.sub(s, letterpos + 1)&lt;br /&gt;
		return s1 .. first .. string.upper(letter) .. rest&lt;br /&gt;
	else&lt;br /&gt;
		return s1 .. s&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.title = function (frame )&lt;br /&gt;
	-- http://grammar.yourdictionary.com/capitalization/rules-for-capitalization-in-titles.html&lt;br /&gt;
	-- recommended by The U.S. Government Printing Office Style Manual:&lt;br /&gt;
	-- &amp;quot;Capitalize all words in titles of publications and documents,&lt;br /&gt;
	-- except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor.&amp;quot;&lt;br /&gt;
	local alwayslower = {['a'] = 1, ['an'] = 1, ['the'] = 1, &lt;br /&gt;
		['and'] = 1, ['but'] = 1, ['or'] = 1, ['for'] = 1,&lt;br /&gt;
		['nor'] = 1, ['on'] = 1, ['in'] = 1, ['at'] = 1, ['to'] = 1,&lt;br /&gt;
		['from'] = 1, ['by'] = 1, ['of'] = 1, ['up'] = 1 }&lt;br /&gt;
	local res = ''&lt;br /&gt;
	local s =  mw.text.trim( frame.args[1] or &amp;quot;&amp;quot; )&lt;br /&gt;
	local words = mw.text.split( s, &amp;quot; &amp;quot;)&lt;br /&gt;
	for i, s in ipairs(words) do&lt;br /&gt;
		s = string.lower( s )&lt;br /&gt;
		if( i &amp;gt; 1 and alwayslower[s] == 1) then&lt;br /&gt;
			-- leave in lowercase&lt;br /&gt;
		else&lt;br /&gt;
			s = mw.getContentLanguage():ucfirst(s)&lt;br /&gt;
		end&lt;br /&gt;
		words[i] = s&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(words, &amp;quot; &amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
-- Capitalizing only first letter for fetched Wikidata labels.&lt;br /&gt;
-- Wikidata English labels generally begin with a lowercase letter. [[:d:Help:Label#Capitalization]]&lt;br /&gt;
p.label = p.ucfirst&lt;br /&gt;
-- stripZeros finds the first number and strips leading zeros (apart from units)&lt;br /&gt;
-- e.g &amp;quot;0940&amp;quot; -&amp;gt; &amp;quot;940&amp;quot;; &amp;quot;Year: 0023&amp;quot; -&amp;gt; &amp;quot;Year: 23&amp;quot;; &amp;quot;00.12&amp;quot; -&amp;gt; &amp;quot;0.12&amp;quot;&lt;br /&gt;
p.stripZeros = function(frame)&lt;br /&gt;
	local s = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	n = tonumber( string.match( s, &amp;quot;%d+&amp;quot; ) ) or &amp;quot;&amp;quot;&lt;br /&gt;
	s = string.gsub( s, &amp;quot;%d+&amp;quot;, n, 1 )&lt;br /&gt;
	return s&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- nowiki ensures that a string of text is treated by the MediaWiki software as just a string&lt;br /&gt;
-- it takes an unnamed parameter and trims whitespace, then removes any wikicode&lt;br /&gt;
p.nowiki = function(frame)&lt;br /&gt;
	local str = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	return mw.text.nowiki(str)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Amycjgrace</name></author>
		
	</entry>
</feed>