natcmp

Natural order comparisons of strings: 'a1' < 'a12'.
https://github.com/restorer/haxe-natcmp

To install, run:

haxelib install natcmp 1.0.0 

See using Haxelib in Haxelib documentation for more information.

README.md

NatCmp

Perform 'natural order' comparisons of strings in Haxe ('a1' < 'a12').

Based on natsort and strnatcmp. Read more in original README.

API

  • NatCmp.natCmp(a : String, b : String) : Int
  • NatCmp.natCaseCmp(a : String, b : String) : Int - compare ignore case
  • NatCmpUtf8.natCmpUtf8(a : String, b : String) : Int - Utf8 version of natCmp
  • NatCmpUtf8.natCaseCmpUtf8(a : String, b : String) : Int - Utf8 version of natCaseCmp

C# note

As far as I know, by default Haxe generated string.Compare() for string comparision, and it result depends on current culture. This may be inconsistent with other compile targets. Eg. "A" < "a" is true for every target except in C# (via Mono at macOS), where "A" > "a".

So by default, C# builds may be different to builds for other targets. Use -D natcmp_cs_compareordinal for more consistent behaviour.

Contributors
restorer
Version
1.0.0
Published
8 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂