Skip to main content

AlphanumComparator

A class in Root.Township, the global namespace.

Non-generic comparer for natural string sorting, so "item2" sorts before "item10". Non-strings compare as equal.

Constructors​

MemberWhat it is
AlphanumComparator()Creates an AlphanumComparator with default values.

Methods​

MemberWhat it is
int Compare(object x, object y)Splits both strings into digit and non-digit runs and compares them in turn, numbers by value.
1 private and internal method
MemberWhat it is
private bool InChunk(char ch, char otherCh)True if a character is the same kind (digit or not) as the run's first character.