Removing Unwanted Commas From A Csv

  • Thread starter Joseph Kreifels II
  • Start date
Status
Not open for further replies.
J

Joseph Kreifels II

Guest
I'm writing a program in Progress, OpenEdge, ABL, and whatever else it's known as.

I have a CSV file that is delimited by commas. However, there is a "gift message" field, and users enter messages with "commas", so now my program will see additional entries because of those bad commas.

The CSV fields are not in double qoutes so I CAN NOT just use my main method with is

/** this next block of code will remove all unwanted commas from the data. **/
if v-line-cnt > 1 then /** we won't run this against the headers. Otherwise thhey will get deleted **/
assign
v-data = replace(v-data,'","',"\t") /** Here is a special technique to replace the comma delim wiht a tab **/
v-data = replace(v-data,','," ") /** now that we removed the comma delim above, we can remove all nuisance commas **/
v-data = replace(v-data,"\t",'","'). /** all nuisance commas are gone, we turn the tabs back to commas. **/


Any advice?

Continue reading...
 
Status
Not open for further replies.
Top