Small Haxe library for working with Unicode characters as code points.
s.Char is an Int abstract with helpers for letters, digits, and case checks.
s.CharArray converts a string to an array of Char without splitting UTF-16 surrogate pairs.
Unicode data is generated from UnicodeData.txt 17.0.0.
import s.Char;
import s.CharArray;
class Main {
static function main() {
var c:Char = "я";
trace(c.isAlpha()); // true
trace(c.isLower()); // true
trace(c.toUpper()); // "Я"
var chars:CharArray = "A𐐨۵中";
trace(chars.length); // 4
trace(chars.toString()); // A𐐨۵中
}
}- Create
CharfromIntorString. toString()converts a code point back to a string.isAlpha(),isLetter(),isDigit(),isUpper(),isLower().toUpper(),toLower().next(),previous().CharArrayconvertsStringtoArray<Char>and back.
Char represents one Unicode code point, not a grapheme cluster.
haxe tests.hxml