So my program task is to load a text file that contains for example:
black | white
And then i open one another text that contain a lot of words, and if for example it will find the word black, it will replace it with white. This code below do that. My problem is that if the text contain Black (with first letter uppercase) it not replace it with White. I know i didn't write anything in the code that will do that but I dont know how to do it. Can someone fill my code?
private void button3_Click(object sender, EventArgs e)
{
OpenFileDialog ofd1 = new OpenFileDialog();
ofd1.Filter = "Text Files|*.txt|SubRipText|*.srt";
if (ofd1.ShowDialog() != DialogResult.Cancel)
{
string text = File.ReadAllText(ofd1.FileName);
for (int x = 0; x < i; x++)
{
if (text.Contains(arr[x, 0]))
{
text = text.Replace(arr[x, 0], arr[x, 1]);
}
}
File.WriteAllText(ofd1.FileName, text);
}
}