Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

schars

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.

Usage

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𐐨۵中
	}
}

API

  • Create Char from Int or String.
  • toString() converts a code point back to a string.
  • isAlpha(), isLetter(), isDigit(), isUpper(), isLower().
  • toUpper(), toLower().
  • next(), previous().
  • CharArray converts String to Array<Char> and back.

Char represents one Unicode code point, not a grapheme cluster.

Tests

haxe tests.hxml

About

Small library for working with chars in Haxe

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

Generated from selibs/shaxelib