Introduce global constant for expected end chars

This commit is contained in:
Ivandro Ismael 2015-08-07 03:53:18 +01:00
parent 14ecb69990
commit ca195d26fe

View File

@ -14,7 +14,7 @@ namespace Nikse.SubtitleEdit.Forms
private readonly List<string> _usedNames = new List<string>();
private int _noOfLinesChanged;
private Subtitle _subtitle;
private const string ExpectedEndChars = " ,.!?:;')<-\"\r\n";
public ChangeCasingNames()
{
InitializeComponent();
@ -150,7 +150,7 @@ namespace Nikse.SubtitleEdit.Forms
int end = startIndex + name.Length;
bool endOk = end <= text.Length;
if (endOk)
endOk = end == text.Length || (@" ,.!?:;')-<""" + Environment.NewLine).Contains(text[end]);
endOk = end == text.Length || ExpectedEndChars.Contains(text[end]);
if (endOk && text.Substring(startIndex, name.Length) != name) // do not add names where casing already is correct
{
@ -178,6 +178,7 @@ namespace Nikse.SubtitleEdit.Forms
string name = listViewNames.SelectedItems[0].SubItems[1].Text;
listViewFixes.BeginUpdate();
foreach (ListViewItem item in listViewFixes.Items)
{
item.Selected = false;
@ -198,7 +199,7 @@ namespace Nikse.SubtitleEdit.Forms
int end = start + name.Length;
bool endOk = end <= lower.Length;
if (endOk)
endOk = end == lower.Length || (@" ,.!?:;')<-""" + Environment.NewLine).Contains(lower[end]);
endOk = end == lower.Length || ExpectedEndChars.Contains(lower[end]);
item.Selected = endOk;
}