Si hubiera tenido tiempo me hubiera gustado poder haberlo hecho sin tener que recurrir a utilizar memoria para leer todo el archivo, pero no pude ni plantearlo.
StringBuilder newFile = new StringBuilder();
string temp = "";
string[] archivo = File.ReadAllLines(@"C:\................txt");
foreach (string linea in archivo)
{
if (linea .Contains("string"))
{
temp = linea .Replace("string", "String");
newFile.Append(temp + "\r\n");
continue;
}
newFile.Append(line + "\r\n");
}
File.WriteAllText(@"C:\......................txt", newFile.ToString());
Thanks!!
string temp = "";
string[] archivo = File.ReadAllLines(@"C:\................txt");
foreach (string linea in archivo)
{
if (linea .Contains("string"))
{
temp = linea .Replace("string", "String");
newFile.Append(temp + "\r\n");
continue;
}
newFile.Append(line + "\r\n");
}
File.WriteAllText(@"C:\......................txt", newFile.ToString());
0 comentarios:
Publicar un comentario