Skip to content

normalize

normalize(input): string

Cleans text that a user typed or pasted. It applies Unicode NFKC, removes the separators that the spec lists, and makes the ASCII letters a to z upper case. The separators are white space (including tabs and line breaks), hyphens and dashes, the full stop, and some zero-width characters. It keeps every other character, such as the right-to-left override U+202E or a letter with an accent. It does not check the result. It does not limit the length of its input. For text from an untrusted source, call parse, which rejects long input before it normalises.

string

Text from a user.

string

The cleaned text.

normalize(' ek-01 a03.fk-01 '); // 'EK01A03FK01'

Unofficial. Not made or endorsed by NIPOST.