Class NaturalSortComparer
Compares two string alpha-numeric with an inner number comparison.
Namespace: Sartorius.SAF.Collections
Assembly: Sartorius.SAF.dll
Syntax
public class NaturalSortComparer : IComparer<string>
Examples
A list of strings: "a3", "a1", "a10", "a12", "a2", "a11", is sorted to: "a1", "a2", "a3", "a11", "a12", "a13". Traditionally the default string comparer sort it to: "a1", "a11", "a12", "a13", "a2", "a3"
Methods
View SourceCompare(string, string)
Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
Declaration
public int Compare(string x, string y)
Parameters
| Type | Name | Description |
|---|---|---|
| string | x | The first object to compare. |
| string | y | The second object to compare. |
Returns
| Type | Description |
|---|---|
| int | A signed integer that indicates the relative values of |