Csv files

Often when I export stuff to csv files I have to ‘fix’ the strings a bit. If people have used comma’s in their text than this tends to mess up the data structure. (all depending on on your regional list separators)
Also Hard Returns / Carriage Returns can cause havoc.

Most likely there are some other characters that can cause havoc but these are the culprits I have run in so far.

Therefore I thought I’ll share this one with you.

//Replace Comma's with points
ReplaceCommas = String.Replace(input, ",", ".");
//Remove hard enters
ReplaceCarriageReturns = String.Replace(ReplaceCommas, "\r", ".");
//Remove new lines
ReplaceNewLines = String.Replace(ReplaceCarriageReturns, "\n", ".");
1 Like