Converting a list to an array when list has quotes and embedded comma This function converts a list to an array when list has quotes and embedded comma:

array function convertRow(required string lstRow) {

    var arResult = [];
    var arTemp = ListToArray(arguments.lstRow, ',', true);

    var quoteMode = false;
    var startQuote = false;

    for (var i in arTemp) {

        if (i CONTAINS '"' &amp;&amp; not quoteMode) { startQuote =  true; }

        if (startQuote) {
            ArrayAppend(arResult, replace(i, '"', ''));

            startQuote = false;
            quoteMode = true;
        }
        else if (quoteMode) {
            arResult[ArrayLen(arResult)] &amp;= "," &amp; replace(i, '"', '');

            if (i CONTAINS '"') quoteMode = false;
        }
        else
            ArrayAppend(arResult, i);
    }

    writedump(lstRow);
    writedump(arResult);

    return arResult;
}
I could get rid of your startQuote variable, I reduced the number of i CONTAINS '"' comparasions by 1.

array function convertRow(required string lstRow) {
    var arResult = [];
    var arTemp = ListToArray(arguments.lstRow, ',', true);
    var quoteMode = false;

    for (var i in arTemp) {
        var containsQuote = i CONTAINS '"';
        if (containsQuote &amp;&amp; not quoteMode) {
            ArrayAppend(arResult, replace(i, '"', ''));
            quoteMode = true;
        }
        else if (quoteMode){
            arResult[ArrayLen(arResult)] &amp;= "," &amp; replace(i, '"', '');
            quoteMode = not containsQuote;
        }
        else{
            ArrayAppend(arResult, i);
        }
    }


    writedump(lstRow);
    writedump(arResult);

    return arResult;
}