"Relocate culture evaluation logic in StringExtensions

The culture type evaluation logic was moved to a more suitable location in the code within the StringExtensions file. This change ensures that the culture type is assessed only when it's necessary, avoiding unnecessary operations and leading to optimized performance."
This commit is contained in:
Ivandro Jao 2023-07-27 12:16:14 +01:00
parent b27dc60631
commit adc8fe703e

View File

@ -789,9 +789,6 @@ namespace Nikse.SubtitleEdit.Core.Common
return false;
}
// evaluate culture type
var isCultureNeutral = twoLetterLanguageCode?.Equals("el", StringComparison.OrdinalIgnoreCase) == false;
// handles when sentence ending char is adjacent with html closing tags e.g: </i>, </font>...
if (value[checkIndex] == '>')
{
@ -820,6 +817,8 @@ namespace Nikse.SubtitleEdit.Core.Common
return checkIndex > 0 && char.IsLetter(value[checkIndex - 1]);
}
// evaluate culture type
var isCultureNeutral = twoLetterLanguageCode?.Equals("el", StringComparison.OrdinalIgnoreCase) == false;
return NeutralSentenceEndingChars.Contains(charAtIndex) || (!isCultureNeutral && GreekSentenceEndingChars.Contains(charAtIndex));
}