lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2013/2/25 Kevin Martin <>:
> Do a gsub that matches a lowercase first letter and replaces it with the upper cased first character of the string.
> Something like: (don't have ref manual in front of me)
> str:gsub("^%l", str:sub(1):upper())

You can simplify that by passing the string.upper function to gsub,
which will then work with a simpler pattern:

Name = name:gsub("^.", string.upper)