unorm_dart는 Unicode 17.0 정규화 알고리즘의 Dart 구현으로, NFC, NFD, NFKC 및 NFKD 형식을 지원합니다. Unicode 문자열을 표준 표현으로 정규화함으로써 일관된 텍스트 처리를 가능하게 하며, 정확한 비교, 검색 및 저장에 필수적입니다. 원래의 walling/unorm 라이브러리 기반으로 Android, iOS, Web, macOS, Windows, Linux에서의 크로스플랫폼 호환성을 보장합니다. 음절 부호, 결합 마크, 특수 기호를 견고하게 다뤄야 하는 국제화 애플리케이션에 적합합니다.
This module exports four functions: nfc, nfd, nfkc, and nfkd; one for each Unicode normalization. In the browser the functions are exported in the unorm global. In CommonJS environments you just require the module. Functions:
unorm.nfd(str) – Canonical Decomposition
unorm.nfc(str) – Canonical Decomposition, followed by Canonical Composition
unorm.nfkd(str) – Compatibility Decomposition
unorm.nfkc(str) – Compatibility Decomposition, followed by Canonical Composition
Usage
A simple usage example:
import"package:unorm_dart/unorm_dart.dart"as unorm;
voidmain() {
var text = "The \u212B symbol invented by A. J. \u00C5ngstr\u00F6m " +
"(1814, L\u00F6gd\u00F6, \u2013 1874) denotes the length " +
"10\u207B\u00B9\u2070 m.";
var combining = RegExp(r"[\u0300-\u036F]");
print("Regular: ${text}");
print("NFC: ${unorm.nfc(text)}");
print("NFKC: ${unorm.nfkc(text)}");
print("NFKD: * ${unorm.nfkd(text).replaceAll(combining, "")}");
print(" * = Combining characters removed from decomposed form.");
}