using System;
using System.IO;
namespace Replace
{
class Program
{
static void Main(string[] args)
{
ReplaceTextFile("file.txt", "Hola", "hola");
}
public static void ReplaceTextFile(string urlFile, string textReplace, string newText)
{
StreamReader myfileRd = File.OpenText(urlFile); ;
StreamWriter myfileWr = File.CreateText("file.txt.out"); ;
string line = " ";
do
{
line = myfileRd.ReadLine();
if (line != null)
{
line = line.Replace(textReplace, newText);
myfileWr.WriteLine(line);
}
}
while (line != null);
myfileWr.Close();
myfileRd.Close();
}
}
}