I am dealing with an old ASP program which manipulates a csv (commadelimited) file to prep records for further process.<BR>The csv file is created from EXCEL and may have numeric fields with commas to separate thousands. <BR>e.g.: .....,"1,234,567.89",....<BR>Same format also for non numeric fields containing commas<BR>e.g.: .....,"this,is,an,alfa,field,full,of,commas",..... <BR>In case the field does not contains commas the format is:<BR>...,1234567.89,... or ...,this is an alfa field full of commas,.... <BR><BR>The old program was solving the problem scanning the whole file byte-by-byte and it is very inefficient.<BR>I would like to do the same exercise using as much as possible standard VBScript functions like split/join and replace<BR>In fact the program has also to replace or suppress some value in the input record.<BR><BR>Caould you be so kind to take a look at one piece of my program and give any advice you find appropriate.<BR><BR>Thanks a lot <BR> Guglielmo<BR><BR>Here is my code:<BR><BR>DIM strLINE, arrFIELDS, strFIELD<BR>Y = chr(34) : TILDA = chr(126) &#039; Y is " (double apix) TILDA is ~ (about) U is &#039; (apix)<BR>i = 1 : U = chr(39) &#039; C is , (comma) Q is ? (question mark) E is = (equal)<BR>C = chr(44) : Q = chr(63) : E = chr(61) <BR> <BR>DO WHILE User_input_file.AtEndOfStream &#060;&#062; True <BR> <BR>strLINE = User_input_file_Readline() &#039;Get a line at a time into a string<BR>arrFIELDS = split(strLINE, C)<BR><BR>For each strFIELD in arrFIELDS<BR> strFIELD = trim(strFIELD) &#039;Elim spaces <BR>Next<BR><BR>strLINE = join(strFIELDS, C) &#039;Re-build the sting <BR>steLINE = replace(strLINE, U, "") &#039;Elimination of apix<BR>strLINE = replace(strLINE, C & Y, Y & Q) &#039;prep comma and double apix (e.g.: ," and ", replaced by "? and ?") <BR>strLINE = replace(strLINE, Y & C, Q & Y) &#039; for double apix elimination and set commas to restate the csv file structure <BR>arrFIELDS = split(strLINE, Y) <BR><BR>For each strFIELD in arrFIELDS<BR> If left(strFIELD, 1) = Q then &#039;If string starts with ? <BR> strFIELD = replace(strFIELD, C, "") &#039;Suppress commas inside ?. . . .? <BR> strFIELD = replace(strFIELD, Q, C) &#039;Replace ? by , <BR> End if<BR>Next<BR> <BR>strLINE = join(arrFIELDS) &#039;Re-build the string <BR>strLINE = replace(strLINE, E, TILDA) &#039;Replace = by ~ <BR><BR>User_input_file_V2_Writeline(strLINE) &#039;Write the output line <BR><BR>LOOP<BR><BR><BR>