I am making a very simple Windows application using Visual Studio and C #, which edits subtitle files for movies. I need a program that adds space to dialogue suggestions when they are not there. For instance:
-Hey what?
-Nothing much.
to
- Hey what?
- Nothing special.
I used the toolbar to create an interface with a single button to select the desired file. This is the code I have for this button:
private void button1_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string text = File.ReadAllText(openFileDialog1.FileName, Encoding.GetEncoding("iso-8859-1")); text = text.Replace("-A", "- A"); File.WriteAllText(openFileDialog1.FileName, text, Encoding.GetEncoding("iso-8859-1")); } }
What this means is basically to replace "-A" with "- A", thus creating space. This is the solution that I came up with, and I planned to do it with each letter, including letters with an accent, such as Γ, Γ, Γ, Γ, etc. Etc.
This does not work. If I put text = text.Replace ("- Γ", "- Γ"); the program does nothing.
I want to know how to fix this.
Thanks for reading, and if you have a better alternative for my application, please feel free to let me know.
source share