Compare alphanumeric text in C, Perl, Python, and lua.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
stralnumcmp.3
stralnumcmp.c
stralnumcmp.h
stralnumcmp.lua
stralnumcmp.pl
stralnumcmp.py
stralnumcmp_test.c
stralnumcmp_test.lua
stralnumcmp_test.pl
stralnumcmp_test.py

README.md

stralnumcmp

A comparator for text mixed alphabet and numeric characters in C language, Python, Perl and Lua, which enables sort like the followings:

9km
10km

or

part9.mp4
part10.mp4

GNU has strverscmp(3) in libc(3). It is similar, but differs the way of interpret strings with leading zeros. strverscmp(3) it as decimals, but this stralnumcmp(3) just ignores them. eg. "01" > "002" in strverscmp(3), but "01" < "002" in stralnumcmp(3).

History

  • 2018-03-29 yasuoka
    • On python and lua implementation, comparing a numeric portion and a non numeric port which starts a char less than 0 didn't work properly