lcStr = filetostr( "TheBad.csv" ) i = 0 FixIt( chr(10) + ",", " ," ) FixIt( [,] + chr(10), " ," ) FixIt( " " + chr(10), " " ) FixIt( chr(10) + " ", " " ) FixIt( chr(10) + chr(10), " " ) FixIt( chr(13) + " ", " " ) FixIt( chr(13) + ",", " ," ) ? "write", datetime() strtofile( lcStr, "TheGood.csv" ) ? "done", datetime() function FixIt( pcSearch, pcFix ) i = i + 1 ? "convert", i, datetime() lcStr = strtran( lcStr, pcSearch, pcFix ) returnTo test the size of strings you can run this code (I wouldn't do it on a 64MB machine unless you have lots and lots of time to wait for virtual memory swaps)
lcStr = "1234567890" for i = 1 to 20 lcStr = lcStr + lcStr endfor for i = 1 to 5 strtofile( lcStr, "c:\temp\bigfile.txt", .t. ) endfor lcStr = filetostr( "c:\temp\bigfile.txt" ) ? datetime(), len( lcStr ) ? datetime(), occurs( '0', lcStr ) lcStr = chrtran( lcStr, '0', 'a' ) ? datetime(), occurs( 'a', lcStr )This creates a 51mb string and changes 5.2 million 0s to a and counts them in about 10 seconds on my machine.