Remove " - quotations marks from a csv file

Hi everyone,

I have a CSV file (actually more than 1, all comma separated not tab) and i need to remove the quotation marks from it; I need to code a win application in which to specify the file and the the application to remove the " . I am new to C#3 so pls any input is appreciated. Thank you


Answer this question

Remove " - quotations marks from a csv file

  • psoDOB

    Ok, those methods are new in VS2005. Here's the equivalent in 1.x:



    StreamReader reader = new StreamReader(filename);
    string contents = reader.ReadToEnd();
    reader.Close();

    StreamWriter writer = new StreamWriter(filename);
    writer.Write(contents.Replace(
    "\"", ""));
    writer.Close();

     



  • Michael Bouck

    thanks alot


  • l11 nad

    by the way.. I am using Visual Studio 2003.


  • bordavide

    Thanks, but it seams that it does not recognize the File.ReadAllText and File.WriteAllText. What should i do ! It might be a dumb question but as i said, I am new to C#. Once again thank you.


  • Bek11



    using System.IO;

    string filename = ...;
    string contents = File.ReadAllText(filename);
    File.WriteAllText(filename, contents.Replace("\"", ""));

     


    Not very efficient, since it reads the complete file into memory, but it works.

  • Remove " - quotations marks from a csv file