Super simple function to include. Really not sure why its missing from the Corona SDK....
function string.capital( str )
local firstLetter = string.sub(string.upper(str), 1, 1);
local otherLetters = string.sub(str, 2);
return firstLetter..otherLetters;
end
Maybe because Ansca isn't making the standart LUA Functions.
But this can be also done this way
1
2
3
| function firstToUpper(str)
return (str:gsub("^%l", string.upper))
end |
Im only saying it should, because theres a lot of noobs out there. The less code someone needs to figure out how to write, the happier they are. I think for the community it should be implemented.