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()

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

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

   return p.titleCase( str )

return p