util.string.title

Shared

Converts a string or codepoint to Unicode titlecase


Syntax

local result = util.string.title(
    input
)

Parameters

TypeNameDescription
string | intinputString to convert, or a single codepoint

Returns

TypeNameDescription
string | intresultTitlecased string, or the titlecase codepoint if input was a number

Examples

Convert a string to titlecase
local result = util.string.title("hello")

core.engine.print("info", result) -- 'Hello'
Titlecase differs from uppercase for some characters
-- Most Latin letters behave the same as upper(), but some scripts differ
local result = util.string.title("dz")

core.engine.print("info", result) -- 'Dz' (titlecase form, distinct from 'DZ' uppercase)
Convert a single codepoint
local code = util.string.title(util.string.byte("h"))

core.engine.print("info", code) -- 72 ('H')

On this page