Cross platform string utils (including utf8 uppercase / lowercase for neko and cpp)
haxelib git zame-stringutils https://github.com/restorer/zame-haxe-stringutils.git
Haxe have excellent haxe.Utf8
class, which allows us to work with utf-8 in a cross-platform way.
But what about cross-platform toLowerCase()
or toUpperCase()
? What regular expression should I write to replace all non-letters (including unicode ones) with, say, spaces?
Utf8Ext
will take care about this on neko
, cpp
and php
, with fallback to native implementation for other platforms.
Utf8Ext.toLoweCase()
to convert utf-8 string to lover case, across all platforms.Utf8Ext.toUpperCase()
to convert utf-8 string to upper case, across all platforms.Utf8Ext.getUnicodeRe()
to get regular expression that matches all characters, including unicode (like /[\p{L}]/
in PCRE).Utf8Ext.getUnicodeRe("^")
to get regular expression that matches all non-characters (like /[\P{L}]/
in PCRE).Utf8Ext.getUnicodeRe("0-9")
will match numbers and characters, while Utf8Ext.getUnicodeRe("^0-9")
will match anything, except numbers and characters.Allows you to generate cool-looking SEO-friendly URL from string on belarusian or russian language.
trace(Transliteration.be("Уладзімір Караткевіч - Хрыстос Прызямліўся Ў Гародні"));
will give you uladzimir-karatkievich-khrystos-pryziamliwsia-w-harodni
, and
trace(Transliteration.ru("Съешь же ещё этих мягких французских булок да выпей чаю"));
will give you s-esh-zhe-eschyo-ehtikh-myagkikh-francuzskikh-bulok-da-vypej-chaju
.
This library is finished. Later I have plant to merge several smaller libraries into bigger one.
Feature | Support status |
---|---|
New features | No |
Non-critical bugfixes | No |
Critical bugfixes | Yes |
Pull requests | Accepted (after review) |
Issues | Monitored, but if you want to change something - submit a pull request |
Estimated end-of-life | Up to 2017 (new library will be created later) |
cd tests
haxelib run munit test
To run tests for specific target:
haxelib run munit test -neko
haxelib run munit test -cpp
haxelib run munit test -js
haxelib run munit test -as3