Function “compareFilenames”
function compareFilenames(a, b)
Performs a file name comparison
When used to sort a list of file names, this sorting function will yield the same order as the one in the file browser. Numerical parts of the file name will be compared numerically, so that numbered files will appear in the right order, even if not padded with zeros.
Parameters
| Name | Type | Description |
|---|---|---|
a | string | First filename to compare |
b | string | Second filename to compare |
Return Value
Returns a number smaller than zero if a comes before b, zero if
both are equal and a number greater than zero if a comes after b.