Deleting/Editing a line in a file.
Hi all, I'm new to .NET C# and I have a challenge to delete or edit a line from a text file which contains 1000 lines. How do I check for the position of the line? And is the a replace method I could use do replace this line with a new one? Currently I search for a line I want to manipulate using Regular Expressions. All I need to know is how can I replace that line?
Johnny GCPosted May 21, 2008, 12:58 AM
you can read the file to a big string and split it into string array (splitted by CRLF or what the terminator is) and then manipulate that array or make a List
Scott LyslePosted May 20, 2008, 1:23 PM
Remove takes as arguments the starting position and the length (of characters to remove).
Replace takes as arguments the old and new strings or character to replace.