mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 20:52:44 +01:00
Introduce constants for type inside loop
This commit is contained in:
parent
ea0a310ee7
commit
5027a528af
@ -684,31 +684,34 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
splitPos = -1;
|
||||
}
|
||||
|
||||
const string expectedChars1 = ".!?, ";
|
||||
const string expectedChars2 = " .!?";
|
||||
const string expectedChars3 = ".!?";
|
||||
if (splitPos < 0)
|
||||
{
|
||||
for (int j = 0; j < 25; j++)
|
||||
{
|
||||
if (mid + j + 1 < s.Length && mid + j > 0)
|
||||
{
|
||||
if (@".!?, ".Contains(s[mid + j]) && !IsPartOfNumber(s, mid + j) && s.Length > mid + j + 2 && CanBreak(s, mid + j, language))
|
||||
if (expectedChars1.Contains(s[mid + j]) && !IsPartOfNumber(s, mid + j) && s.Length > mid + j + 2 && CanBreak(s, mid + j, language))
|
||||
{
|
||||
splitPos = mid + j;
|
||||
if (@" .!?".Contains(s[mid + j + 1]))
|
||||
if (expectedChars2.Contains(s[mid + j + 1]))
|
||||
{
|
||||
splitPos++;
|
||||
if (@" .!?".Contains(s[mid + j + 2]))
|
||||
if (expectedChars2.Contains(s[mid + j + 2]))
|
||||
splitPos++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (@".!?, ".Contains(s[mid - j]) && !IsPartOfNumber(s, mid - j) && s.Length > mid + j + 2 && CanBreak(s, mid - j, language))
|
||||
if (expectedChars1.Contains(s[mid - j]) && !IsPartOfNumber(s, mid - j) && s.Length > mid + j + 2 && CanBreak(s, mid - j, language))
|
||||
{
|
||||
splitPos = mid - j;
|
||||
if (@".!?".Contains(s[splitPos]))
|
||||
if (expectedChars3.Contains(s[splitPos]))
|
||||
splitPos--;
|
||||
if (@".!?".Contains(s[splitPos]))
|
||||
if (expectedChars3.Contains(s[splitPos]))
|
||||
splitPos--;
|
||||
if (@".!?".Contains(s[splitPos]))
|
||||
if (expectedChars3.Contains(s[splitPos]))
|
||||
splitPos--;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user