Difference between revisions of "Module:SentenceCase"

From Nookipedia, the Animal Crossing wiki
m
m
Line 5: Line 5:
 
     local args        = getArgs(frame)
 
     local args        = getArgs(frame)
 
local name        = args['1'] or ''
 
local name        = args['1'] or ''
    return p.firstToUpper(name)
+
local sentenceCase = firstToUpper(name)
 +
    return sentenceCase
 
end
 
end
  
 
-- https://stackoverflow.com/questions/2421695/first-character-uppercase-lua
 
-- https://stackoverflow.com/questions/2421695/first-character-uppercase-lua
function p.firstToUpper(name)
+
function firstToUpper(name)
     return mw.getContentLanguage():ucfirst(name)
+
     return (name:gsub("^%l", string.upper))
 
end
 
end

Revision as of 17:01, November 22, 2022

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

local p = {}
local getArgs = require('Module:Arguments').getArgs

function p.main(frame)
    local args         = getArgs(frame)
	local name         = args['1'] or ''
	local sentenceCase = firstToUpper(name)
    return sentenceCase
end

-- https://stackoverflow.com/questions/2421695/first-character-uppercase-lua
function firstToUpper(name)
    return (name:gsub("^%l", string.upper))
end