string.casefold()
Convert a String to lower case using a specified format.
Description
Converts the calling String to lower case. This method is similar to
string.toLowerCase()
but uses an optionally
specified format. The calling String isn’t changed.
Parameters
Parameter | Type | Required | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
format |
Unicode normalization form applied to the converted String:
See also: Unicode Normalization Forms. |
Examples
-
Convert an email address to lower case using the default NFKC normalization form:
"john.doe@EXAMPLE.COM".casefold()
"john.doe@example.com"
-
Convert an email address to lower case using the NFC normalization form:
"john.doe@EXAMPLE.COM".casefold("NFC")
"john.doe@EXAMPLE.COM"
-
Default convert Unicode sequence to lower case:
"\uff21\u0030a\u0301".casefold()
"a0á"
-
Convert the same Unicode sequence using
NFCK
option:"\uff21\u0030a\u0301".casefold("NFKC")
"A0á"
-
Convert the same Unicode sequence using
NFC
option:"\uff21\u0030a\u0301".casefold("NFC")
"A0á"