Thanks Ben, the problem with that script is that because I'm reading a log file with 300 plus rows of data, the execution time suffers. Is there a way to only run your code if somewhere in the string there is a comma inside double quotes?

>Try this:
>
><cfset string = '11/12/2003, "bob", "this is a ,comma,list","end"'>
><cfscript>
> string = string & ",";
> first = find('"', string);
> second = find('"', string, first + 1);
> while(first and second)
> {
> string = left(string, first) & replace(mid(string, first + 1,
>second-first), ',', '~', "all") & right(string, len(string) - second);
> first = find('"', string, second + 1);
> second = find('"', string, first + 1);
> }
></cfscript>
>
>
>You'll notice that I append a comma to the end of the list.  This is so
>that a double-quote can't be the last character.  Sine CF ignores empty
>list entries, this shouldn't affect the rest of your code.  If it does,
>just strip the last character at the end of the script.
>
>HTH.
>
>--Ben Doom
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to