How would I go about replacing a string in an existing text file? For example, the file example.txt contains:
Item1
Item2
Item3
I have no problem iterating through the file and getting each line value, but is there some way to say, replace the value "Item2" with "newItem2" without touching the rest of the file?
Thanks in advance.
Item1
Item2
Item3
I have no problem iterating through the file and getting each line value, but is there some way to say, replace the value "Item2" with "newItem2" without touching the rest of the file?
Thanks in advance.