naturalSortCompare
function naturalSortCompare(a, b): number;Defined in: string.ts:29
Natural sort comparator (Finder/Explorer-like). Numbers within strings are compared numerically, not lexicographically.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
a |
string |
b |
string |
Returns
Section titled “Returns”number
Example
Section titled “Example”["file10", "file2", "file1"].sort(naturalSortCompare);// ["file1", "file2", "file10"]