Haha.. yes, I am catching the 'magic' experience of using scripts. I realize I need to perfect my knowledge of functions, methods, and syntax. Having said that, the doors open quite wide with these abilities.

This post will look VERY long because I paste in some lists I am working with and the result of processes done to sort them.

Gaev wrote:DavidP:

I am using the tick "`" as a delimiter.

a) Not usually a good idea to use special characters (like the tick mark) as a delimiter.

My lists to sort will contain commas

I have tested that the .sort() works. I am finding errors with the .reverse() process

Gaev wrote:a) What is the error ?

.

I will place my data in code boxes below. Essentially, it appears the .sort() process has limitations. It sorts part and then sorts the rest in a new order (see below). What I was seeing as a problem with the .reverse() process was actually that it showed the original imperfect sort in reverse

I think this was likely not intended for anything but small lists ( <50).

Gaev wrote:In order to determine what does not work, you need to take this one step at a time ... when you go from "expected' to "unexpected", you have zeroed in on the problem ....

Many thanks to Gaev and Tony Kroos to help me develop stronger scripting skills.

I have solved the sorting problem to my satisfaction. To address the upper/lower case issue, I copy the line, make it lower case, append it to the original line with upper/lower with a delineator between them. Then I sort. When done, I strip out the lowercaseonly portion and write a new array with the original value.

(I had to use a regular expressions tricks (.replace) to delete a leading [#10] symbol from result string. Source string is taken from Listbox with pipe delimiters and "joined" again with [#10] delimiters to fit into Listbox again)

1) I really don't understand "why the specification of a function in the .sort() method does what it does" ... or even "what passed parameters a and b are supposed to represent".

I am guessing that the Javascript .sort method is doing some sort of "bubble sort" and calls the specified function each time it is comparing an Array Item (a) with an adjacent one (b) ... and the function is returning a value (-1 or 0 or 1) to indicate the relative sort order of the two items.

Gaev wrote:I am guessing that the Javascript .sort method is doing some sort of "bubble sort" and calls the specified function each time it is comparing an Array Item (a) with an adjacent one (b) ... and the function is returning a value (-1 or 0 or 1) to indicate the relative sort order of the two items.

A wiki about algorithm used in js sort() method and explanation.
a and b are the parameters (two array elements which are compared with each other) passed by the sort method to function.