utf8.fold()

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

Overview

Converts a UTF-8 string to folded case. This is useful for comparing strings while ignoring letter case. For most purposes this is equivalent to utf8.lower(). See the Unicode documentation for further details.

Syntax

utf8.fold( s )
s (required)

String. The string to convert.

Example

local utf8 = require( "plugin.utf8" )

local testStr = utf8.escape( "%xB5, %x130, %x17F, %x345, %x3C2, %x3D0, %x3D1, %x3D5, %x3D6, %x3F0, %x3F1, %x3F5, %x1E9B, %x1FBE" )

print( utf8.lower( testStr ) )  --> µ, i, ſ,  ͅ, ς, ϐ, ϑ, ϕ, ϖ, ϰ, ϱ, ϵ, ẛ, ι
print( utf8.fold( testStr ) )   --> μ, İ, s, ι, σ, β, θ, φ, π, κ, ρ, ε, ṡ, ι