Module:College color/sandbox: Difference between revisions

Content deleted Content added
lower
ucfirst?
Line 10:
local function stripwhitespace(text)
return text:match("^%s*(.-)%s*$")
end
local function ucfirst(s)
local first = s:sub(1, 1)
local others = s:sub(2, -1)
return first:upper() .. others
end
local function bordercss(c, w)
Line 389 ⟶ 394:
 
local res = ''
if (#colornames > 0) then
colornames[1] = ucfirst(colornames[1])
end
if (#colornames == 1) then
res = colornames[1]
elseif (#colornames == 2) then
res = colornames[1] .. ' and ' .. colornames[2]:lower()
elseif (#colornames > 2) then
res = colornames[1]
for i=2,#colornames do
if( i < #colornames ) then
res = res .. ',&nbsp;' .. colornames[i]:lower()
else
res = res .. ',&nbsp;and&nbsp;' .. colornames[i]:lower()
end
end