Hello all,Iam trying to use CSV reader in my console application where i am reading txt file and inserting data into database.
But while using CSV reader to read text file,as text file containg multiple delimeters i between fields.
I wanna trim multiple delimeters to single ,so that i can read and insert it to database.
How to trim multiple delimeters to single.
Delimeter is"/t".
can anyone suggest?

You should read the CSV file as a normal text file i.e. one line at the time. Now, when you have a line as a string, you can use string.Replace() method to remove multiple delimeters.

string OneLine;
StreamReader fReader = null;
string[] Buffer;

fReader = new StreamReader(FileName,Encoding.Default, true);
while (!fReader.EndOfStream)
  OneLine = fReader.ReadLine();
  // Remove multiple delimiters
  while (OneLine.IndexOf(@"\t\t") >= 0) OneLine.Replace(@"\t\t", @"\t");
  Buffer = OneLine.Split(Convert.ToChar(9));
  // At this point Buffer[0], Buffer[1], ... contains values to put in the DB


Or, you can use

Buffer = OneLine.Split(Convert.ToChar(9),StringSplitOptions.RemoveEmptyEntries);

but this may work a bit differently in some cases.