JavaScript normalize function All In One
Unicode string / Emoji string
国际化
String.prototype.normalize()
The normalize()
method returns the Unicode Normalization Form
of the string.
normalize()
normalize(form)
form
Optional
One of "NFC", "NFD", "NFKC", or "NFKD", specifying the Unicode Normalization Form
.
If omitted or undefined, "NFC
" is used.
These values have the following meanings:
"NFC"
Canonical Decomposition, followed by Canonical Composition.
"NFD"
Canonical Decomposition.
"NFKC"
Compatibility Decomposition, followed by Canonical Composition.
"NFKD"
Compatibility Decomposition.
// 默认值 NFC
`曌`.length;
// 1
`曌`.normalize().length;
// 1
`曌`.normalize(`NFC`).length;
// 1
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
Node.normalize()
https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize
ConvolverNode.normalize
https://developer.mozilla.org/en-US/docs/Web/API/ConvolverNode/normalize
normalize-space
XPath
normalize-space( [string] )
https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/normalize-space