Update StringExtensions.cs

This is intended to fix #2773.
This commit is contained in:
mkver 2018-02-18 13:42:00 +01:00 committed by GitHub
parent b24eb52937
commit 838bfacf67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,7 +211,7 @@ namespace Nikse.SubtitleEdit.Core
s = s.Remove(i + 1, k - (i + 2));
}
// No white-space after/before line break.
// No white-space after line break.
if ((ch == '\n' || ch == '\r') && i + 1 < s.Length && s[i + 1] == 0x20)
{
s = s.Remove(i + 1, 1);
@ -221,7 +221,8 @@ namespace Nikse.SubtitleEdit.Core
}
if (ch == 0x20 && i + 1 < s.Length && (s[i + 1] == '\n' || s[i + 1] == '\r'))
{
s = s.Remove(i, 1);
s = s.Remove(i, 1);// No white-space before line break
k = -1; // Reset remove length -- see issue 2773.
}
}
return s;