From ca195d26fecdb2819e39e4fbba2492166db321a8 Mon Sep 17 00:00:00 2001 From: Ivandro Ismael Date: Fri, 7 Aug 2015 03:53:18 +0100 Subject: [PATCH] Introduce global constant for expected end chars --- src/Forms/ChangeCasingNames.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Forms/ChangeCasingNames.cs b/src/Forms/ChangeCasingNames.cs index 2c221b685..b584de80b 100644 --- a/src/Forms/ChangeCasingNames.cs +++ b/src/Forms/ChangeCasingNames.cs @@ -14,7 +14,7 @@ namespace Nikse.SubtitleEdit.Forms private readonly List _usedNames = new List(); 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; }