I just want to edit a txt and save the edited version.
In this case i replaced all the i's with q's.
Is there an easier way to do this? Without all the casting?
In this case i replaced all the i's with q's.
Is there an easier way to do this? Without all the casting?
Code:
static void Main(string[] args){
string[] text = File.ReadAllLines("test.txt");
char[] help;
for (int i = 0; i < text.Length; i++) {
help = text[i].ToArray();
for (int j = 0; j < help.Length; j++){
if (help[j] == 'i')
help[j] = 'q';
}
text[i] = new String(help);
}
File.WriteAllLines("test_alt.txt",text);
}
}
Comment