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

Z Nonsensopedii, polskiej encyklopedii humoru
M (Wycofano ostatnie edycje autorstwa Modularny jebaka; przywrócono ostatnią wersję autorstwa Ostrzyciel.)
Znacznik: rewert
M
Linia 2: Linia 2:


function p.firstsmall(frame)
function p.firstsmall(frame)
local text = frame.args[1]
return p.firstSmallL(frame.args[1])
end

function p.firstSmallL(text)
if text == nil or text:len() == 0 then
if text == nil or text:len() == 0 then
return ''
return ''
Linia 13: Linia 16:


function p.firstlarge(frame)
function p.firstlarge(frame)
local text = frame.args[1]
return p.firstLargeL(frame.args[1])
end

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

Wersja z 12:11, 8 mar 2020


local p = {}

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

function p.firstSmallL(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.firstLargeL(frame.args[1])
end

function p.firstLargeL(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