我有 2 个双引号需要用一个双引号替换。
我正在使用这种方法:
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));
}
}
}
}
}
并这样称呼它
ReplaceTextInFile(file, file + "new", (char)34 + (char)34, (char)34);
我得到的错误是
Error 4 Argument '3': cannot convert from 'int' to 'string'
and Error 5 Argument '4': cannot convert from 'char' to 'string'
我究竟做错了什么?