string.capitalize(str)

Capitalize the string : All letters are lowered except the first character of the string.

Parameters

str

A string that will be capitalized.

This function will try to capitalize the string, even for UTF8 characters.

Return value

Returns a new string with the same content but capizalized.

Example

local console = require "console" console.write('Enter your name : ') local name = string.capitalize(console.readln()) print('Hi '..name..' !')