I have this months array:
[\"January\", \"March\", \"December\" , \"October\" ]
And I want to have it sorted like this:
[\"
Create a table with name->index, then sort the array based on its value in the table.
A couple of examples may be useful, in C# arr.sort(myCompare)
, in Java Collections.sort(arr, myCompare)
, in Python arr.sort(myCompare)
, in PHP usort($arr, 'myCompare')
, in C++ sort(vec.begin(), vec.end(), myCompare)
.