compareNatural

Compares two strings in a way that is natural to humans. Integers come before non-integers, and integers are compared as if they were numbers instead of strings of characters. Best used in opCmp overloads.

int
compareNatural
(
T
)
(
const T a
,
const T b
)
if (
isSomeString!T
)
out (result) { assert (result <= 1, "Result too large"); assert (result >= -1, "Result too small"); }

Return Value

Type: int

-1 if a comes before b, 0 if a and b are equal, 1 if a comes after b

Meta