Clash of Clans Wiki
Clash of Clans Wiki

Documentation for this module may be created at Module:Title Case/doc

-- Capitalize the first letter of every word in a string.
local p = {}

local function titleCase( first, rest )
   return first:upper() .. rest:lower()
end

function p.titleCase( str )
   str = str:gsub( "(%a)([%w_']*)", titleCase )
   return str
end

function p.main( frame )
   local str = frame.args[ 1 ]

   return p.titleCase( str )
end

return p