Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Altered:
Function [other Function type actions]
Item [operators of similar scope]
Data manipulation [other Data manipulation operators]
5.8.0
List.isort()
The basic form
$MyList = $MyList.isort()
$MyList = $MyList.isort().reverse()
This function re-sorts the referenced list in lexical, case-insensitive order. This means sorting letters in alphabetical order "a,b,c'" with all upper case instances sorting before any lower case ones as in "ant;Ant;bee;Bee;cow;Cow". Lexical sort of numbers means '1,11,2' not 1,2,11' as might be expected.
Alternative sorts are a lexical case-sensitive List.sort(), and a numeric List.nsort(). Or, use the optional long from (below) and let the nominated attribute's data type set the form of sort, e.g for date sorting.
The resulting sort order can be reversed overall by chaining the List.isort() and List.reverse() functions.
List.isort($Attribute)
In this optional extended form there is a requirement that the referenced list is a list of notes names or paths, i.e. $Path data or $Name data where note names are all unique. In such a case, the sort order can be based on a stipulated $Attribute name.
$MyList = $MyList.isort($Name)
$MyList = $MyList.isort($MyString)
$MyList = $MyList.isort($Name).reverse()
In this long form usage, the sort ordering is based on the data type of $Attribute:
- Number type - numerical sort
- Date type - sort on date (implied numerical)
- All other types lexical
With isort() lexical sorts are always case-insensitive.