Visual Basic 2013 String Replacement
- by user3707612
I found this code that replaces a string in a text file. But, I am trying to make it so that it replaces several strings in a text file.
My.Computer.FileSystem.WriteAllText("C:\windows\PrinterList2.txt", My.Computer.FileSystem.ReadAllText("C:\windows\PrinterList.txt").Replace("IT", "ADM-IT"), False)
For example, I need it to replace "IT" with "ADM-IT" and "AR" with "ADM-AR" and possibly a hundred or so more.
How can I get it to loop to do them all? Running this line of code over and over just overwrites the file with the last item for replacement.
Thanks in advance.