CaseFold
Casefold( value, [ normalizer ] )
Casefold( value, [ normalizer ] )
Casefold( value, [ normalizer ] )
Casefold( value, [ normalizer ] )
casefold( value, [ normalizer ] )
casefold( value, [ normalizer ] )
Casefold( value, [ normalizer ] )
Casefold( value, [ normalizer ] )
Description
The CaseFold
function returns a normalized string. When strings are
transformed into their normalized forms, canonical-equivalent strings
have precisely the same binary representation. Then, a binary comparison
function such as equals
can compare two strings for case-insensitive
matching.
The Unicode Standard provides well-defined normalization forms (see Section 5.18, Case Mappings).
By default, FaunaDB uses NKFCCaseFold
as recommended by the
W3C, but provides NFKCCaseFold
,
NFC
, NFD
, NFKC
, NFKD
.
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
String |
A string to normalize. |
|
String |
Optional - The name of the normalizer method to use. Must be one of "NFKCCaseFold", "NFC", "NFD", "NFKC", or "NFKD". Defaults to "NFKCCaseFold". |
Examples
The query below converts the string "Hen Wen" to "hen wen" to support case-insensitive matching.
curl https://db.fauna.com/ \
-u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
-d '{ "casefold": "Hen Wen" }'
client.Query(Casefold("Hen Wen"));
System.out.println(
client.query(Casefold(Value("Hen Wen")))
.get());
result, _ := client.Query(f.Casefold("Hen Wen"))
fmt.Println(result)
client.query(Casefold("Hen Wen"))
client.query(q.casefold("Hen Wen"))
$client.query do
casefold 'Hen Wen'
end
client.query(Casefold("Hen Wen"))
client.query(q.Casefold('Hen Wen'))
.then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": "hen wen" }
"hen wen"
"hen wen"
hen wen
"hen wen"
"hen wen"
"hen wen"
"hen wen"
hen wen
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!