Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

string.casefold()

Aggressively convert the calling string to lower case.

Signature

casefold() => String

casefold(format: String) => String

Description

The casefold() method converts the calling string to lower case similar to the toLowerCase() method but converts more aggressively according format. The calling string isn’t changed.

Parameters

Parameter Type Required Description

format

Unicode normalization form applied to the converted string:

Normalization form Description

NFKCCaseFold

(Default) Characters are decomposed by compatibility then recomposed by canonical equivalence.

NFC

Canonical decomposition followed by canonical composition. Characters are decomposed and then recomposed by canonical equivalence.

NFD

Canonical decomposition. Characters are decomposed by canonical equivalence, and multiple combining characters are arranged in order.

NFKC

Compatibility decomposition, followed by canonical composition. Characters are decomposed by compatibility then recomposed by canonical equivalence.

NFKD

Compatibility decomposition. Characters are decomposed by compatibility, and multiple combining characters are arranged in order.

Return value

Type Description

String

Value of the calling string converted to lower case, according to format.

Examples

  1. Convert an email address to lower case using the default NFKC normalization form:

    "john.doe@EXAMPLE.COM".casefold()
    "john.doe@example.com"
  2. Convert an email address to lower case using the NFC normalization form:

    "john.doe@EXAMPLE.COM".casefold("NFC")
    "john.doe@EXAMPLE.COM"
  3. Default convert Unicode sequence to lower case:

    "\uff21\u0030a\u0301".casefold()
    "a0á"
  4. Convert the same Unicode sequence using NFCK option:

    "\uff21\u0030a\u0301".casefold("NFKC")
    "A0á"
  5. Convert the same Unicode sequence using NFC option:

    "\uff21\u0030a\u0301".casefold("NFC")
    "A0á"

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!