IR Framework

SortMonthNames Function

Provides a means to sort month names by their numbers.
[ActiveDocument.]SortMonthNames (a, b)
Array.sort([ActiveDocument.]SortMonthNames)

Arguments

a
Required. The first value to use in the comparison.


b
Required. The second value to use in the comparison.



Return Value

The SortMonthNames function returns the following values:
If SortMonthNames returns
Neither a nor b is in the MonthName array and a = "Month25" -1
Neither a nor b is in the MonthName array and b = "Month25" 1
Neither a nor b is in the MonthName array and Neither a nor b = "Month25"
a == b 0
a < b -1
a > b 1
a is not in the MonthName array 1
b is not in the MonthName array -1
a nor b are both in the MonthName array month number of a minus month number of b


Remarks

The following example uses SortMonthNames to sort a list of months by month number:

var arr = new Array("April", "August", "December", "February", "January", "July", "June", "March", "May", "November", "October", "September");
arr.sort(SortMonthNames);
Console.Writeln(arr.toString());    //  returns January,February,March,April,May,June,July,August,September,October,November,December


Requirements