Module:Sandbox/RexxS/String2

-- Later versions available in module space as Module:String2

local p = {}

p.upper = function(frame) local s = mw.text.trim(frame.args[1] or "") return string.upper(s) end

p.lower = function(frame) local s = mw.text.trim(frame.args[1] or "") return string.lower(s) end

p.sentence = function (frame ) local s = mw.text.trim( frame.args[1] or "" ) local letterpos = string.find(s, '%a') if letterpos then local first = string.sub(s, 1, letterpos - 1) local letter = string.sub(s, letterpos, letterpos) local rest = string.sub(s, letterpos + 1) return first .. string.upper(letter) .. string.lower(rest) else return s	end end

return p