Question: Say I have the following list:

```
<cfset myList = "1a,2b,3c,aa,bb,cc" >

```

How do I sort this list so that it will be "aa,bb,cc,1a,2b,3c"? In other words, I want anything that starts with a number to be at the end of the list and in order of the number it starts with.

Answer: 
This will work if you are on CF10+.

```
<cfscript>
    values = listToArray("1a,2b,3c,aa,bb,cc");
    arraySort(values, function(e1, e2) {
        var diff = val(e1) - val(e2);
        if(diff != 0)
            return diff;
        return e1 < e2 ? -1 : 1;
    });
    writedump(values);
</cfscript>

```

Run: <http://www.trycf.com/scratch-pad/pastebin?id=kKY9y2Nn>

**UPDATE**

But since you're using CF9:

```
<cfscript>
    function customSort(input) {
        var sorted = false;
        while (!sorted) {
            sorted = true;
            for (var i = 1; i < arrayLen(input); i++) {
                var e1 = input[i];
                var e2 = input[i + 1];
                var diff = val(e1) - val(e2);
                if (diff == 0 ? e1 > e2 : diff > 0) {
                    arraySwap(input, i, i + 1);
                    local.sorted = false;
                }
            }
        }
        return input;
    }
    values = listToArray("1a,2b,3c,3a,aa,bb,cc");
    writeDump(customSort(values));
</cfscript>

```

Run: <http://www.trycf.com/scratch-pad/pastebin?id=XK3fQv9T>
I am assuming you are using MySql. I am not sure whether it will work on others, but I think it should. You can do this on database level if the source of the values is a single column. Try this:

```
SELECT column_name 
FROM   your_table 
ORDER BY IF(name RLIKE '^[a-z]', 1, 2), name

```

See this [runnable example on SQLFiddle.com](http://sqlfiddle.com/#!2/f7b96/2)