Moduł:Narzędzia: Różnice pomiędzy wersjami

Z Nonsensopedii, polskiej encyklopedii humoru
M
M
Linia 1: Linia 1:
local p = {}
local p = {}


function p.firstsmall(frame)
function p.firstSmall(frame)
return p.firstSmallL(frame.args[1])
return p._firstSmall(frame.args[1])
end
end


function p.firstSmallL(text)
function p._firstSmall(text)
if text == nil or text:len() == 0 then
if text == nil or text:len() == 0 then
return ''
return ''
Linia 15: Linia 15:
end
end


function p.firstlarge(frame)
function p.firstLarge(frame)
return p.firstLargeL(frame.args[1])
return p.firstLarge(frame.args[1])
end
end


function p.firstLargeL(text)
function p._firstLarge(text)
if text == nil or text:len() == 0 then
if text == nil or text:len() == 0 then
return ''
return ''

Wersja z 16:31, 9 mar 2020


local p = {}

function p.firstSmall(frame)
    return p._firstSmall(frame.args[1])
end

function p._firstSmall(text)
    if text == nil or text:len() == 0 then
        return ''
    end
        
    text = string.sub(text, 1, 1):lower() .. string.sub(text, 2, -1)
    
    return text   
end

function p.firstLarge(frame)
    return p.firstLarge(frame.args[1])
end

function p._firstLarge(text)
    if text == nil or text:len() == 0 then
        return ''
    end
        
    text = string.sub(text, 1, 1):upper() .. string.sub(text, 2, -1)
    
    return text   
end

return p