I have 2 double quotes that need to be replaced by a single double quote.
I am using this method:
private static void ReplaceTextInFile(string originalFile, string outputFile, string searchTerm, string replaceTerm)
{
string tempLineValue;
using (FileStream inputStream = File.OpenRead(originalFile))
{
using (StreamReader inputReader = new StreamReader(inputStream))
{
using (StreamWriter outputWriter = File.AppendText(outputFile))
{
while (null != (tempLineValue = inputReader.ReadLine()))
{
outputWriter.WriteLine(tempLineValue.Replace(searchTerm, replaceTerm));
}
}
}
}
}
and calling it this way
ReplaceTextInFile(file, file + "new", (char)34 + (char)34, (char)34);
the error i am getting is
Error 4 Argument '3': cannot convert from 'int' to 'string'
and Error 5 Argument '4': cannot convert from 'char' to 'string'
what am i doing wrong?
I’d use
ReplaceTextInFile(file, file + "new", "\"\"", "\"");