Improved RemoveSubStationAlphaFormatting

This commit is contained in:
ivandroly 2015-07-14 02:57:48 +00:00
parent eee06fe2e4
commit af0b8932ca

View File

@ -427,11 +427,13 @@ namespace Nikse.SubtitleEdit.Forms
private static string RemoveSubStationAlphaFormatting(string s)
{
int indexOfBegin = s.IndexOf('{');
while (indexOfBegin >= 0 && s.IndexOf('}') > indexOfBegin)
while (indexOfBegin >= 0)
{
int indexOfEnd = s.IndexOf('}');
s = s.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1);
indexOfBegin = s.IndexOf('{');
int indexOfEnd = s.IndexOf('}', indexOfBegin + 1);
if (indexOfEnd < indexOfBegin)
break;
s = s.Remove(indexOfBegin, indexOfEnd - indexOfBegin + 1);
indexOfBegin = s.IndexOf('{', indexOfBegin);
}
return s;
}