compareNaturalSort

Natural string comparison function for use with phobos's sorting algorithm

nothrow @safe pure
bool
compareNaturalSort
(
inout(char[]) a
,
inout(char[]) b
)

Return Value

Type: bool

true if a < b

Examples

assert(sort!compareNaturalSort(array(["0", "10", "1"])) == ["0", "1", "10"]);
assert(sort!compareNaturalSort(array(["a", "c", "b"])) == ["a", "b", "c"]);
assert(sort!compareNaturalSort(array(["a1", "a"])) == ["a", "a1"]);

Meta