Double commas in CSV file in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • E11esar
    New Member
    • Nov 2008
    • 132

    Double commas in CSV file in C#

    Hello there.

    I am reading in a CSV file and have found that where a field is null (empty) I need to replace this with a value, such as 0.

    In an ideal world the following command would work:

    stringName.Repl ace(",,", ",0,");

    This does not work but I am wondering if there is a way to replace the double commas in the string with ,0, values?

    The input file is very large so editing the file and find/replacing isn't suitable as ultimately this needs to be an automated process with very little intervention, save for browsing to and clicking a load button.

    Any help would be very welcome, please.

    Thank you.

    Mark :o)
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Why doesn't that work? Seems like it would, might take a bit, but should work.
    If you are producing the file, check to see if the value you are about to write is empty, and if so write a 0?

    Comment

    • E11esar
      New Member
      • Nov 2008
      • 132

      #3
      Okay I have obviously been working too hard of late as "yes" that has worked..! Not sure why I have had issues with this today but honestly, I've been playing with this for the past hour or so...

      Well, it is Friday!!

      Thank you for answering :o)

      Comment

      Working...