Jump to content

Module:LowercaseFirstLetter

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Sdrqaz (talk | contribs) at 23:50, 17 March 2025 (Removed protection from "Module:LowercaseFirstLetter": No longer necessary: Requested at RfPP with zero transclusions). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

function p.getModifiedTitle(frame)
    local title = mw.title.getCurrentTitle().text

    local rest = mw.ustring.sub(title, 2)
    if mw.ustring.find(rest, "%u") then
        return title
    else
        local first = mw.ustring.sub(title, 1, 1):lower()
        return first .. rest
    end
end

return p