lua-users home
lua-l archive

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


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())

Kev.

Sent from my iPhone

On 25 Feb 2013, at 11:39, luciano de souza <luchyanus@gmail.com> wrote:

> Hello all,
> It seems to be so simpler, but in spite of this, I could not think a
> simpler way to do.
> I have the following string:
> 
> name = 'luciano'
> 
> The first leter should be capitalized , but only the first one. If I
> use "string.upper(name)", all the string will be changed.
> So, my question is, how to get "Luciano", as the changed string, in
> other others, how to ccapitalize only one character?
> Regards,
> Luciano
>