Replace double double quote from string

  • Thread starter Thread starter DarkKnhight
  • Start date Start date
D

DarkKnhight

Guest
Team,


I am getting data from an external source and trying to convert into an excel file. I need to validate the source data. Sometimes get junk data inside input fields like "Hello ""doctor"" hello". The goal is to output it as "Hello \""doctor\"" hello" inside the excel field


Wrote something like this


try
{
string searchString = @"\\""";
if (string.IsNullOrEmpty(customerName)) return "NULL";
if (customerName.Contains(searchString))
return customerName.Replace(searchString, @"\""");
return customerName;
}
catch(Exception ex)
{
throw ex;
}

IS there any way we can fix this?

Thanks

Tutumon

Continue reading...
 
Back
Top