utf8.title()

Type Function
Library utf8.*
Return value String
Revision Release 2024.3703
Keywords utf8, UTF-8, Unicode, string, title
See also utf8.escape()
utf8.fold()

Overview

Converts a UTF-8 string to title case. This is special type of uppercase which differs for a few language-specific characters. See the Unicode documentation for further details.

Syntax

utf8.title( s )
s (required)

String. The string to convert.

Example

local utf8 = require( "plugin.utf8" )

local testStr = utf8.escape( "%x1C4, %x1C5, %x1C6, %x1C7, %x1C8, %x1C9, %x1CA, %x1CB, %x1CC, %x1F1, %x1F2, %x1F3, %x1F9" )

print( testStr )                --> DŽ, Dž, dž, LJ, Lj, lj, NJ, Nj, nj, DZ, Dz, dz, ǹ
print( utf8.upper( testStr ) )  --> DŽ, DŽ, DŽ, LJ, LJ, LJ, NJ, NJ, NJ, DZ, DZ, DZ, Ǹ
print( utf8.title( testStr ) )  --> Dž, Dž, Dž, Lj, Lj, Lj, Nj, Nj, Nj, Dz, Dz, Dz, Ǹ