Lower all tags, possible bugs fix

This commit is contained in:
ivandrofly 2015-02-08 20:15:41 +00:00
parent 6fd8c45f3a
commit fe884a4a58

View File

@ -741,6 +741,18 @@ namespace Nikse.SubtitleEdit.Logic
internal static string RemoveLineBreaks(string s)
{
var tags = new string[] { "<I>", "<U>", "<B>", "<FONT" };
var idx = s.IndexOfAny(tags, StringComparison.Ordinal);
while (idx >= 0)
{
var endIdx = s.IndexOf('>', idx + 3);
if (endIdx < idx)
break;
var tag = s.Substring(idx, endIdx - idx).ToLowerInvariant();
s = s.Remove(idx, endIdx - idx).Insert(idx, tag);
idx = s.IndexOfAny(tags, StringComparison.Ordinal);
}
s = s.Replace(Environment.NewLine + "</i>", "</i>" + Environment.NewLine);
s = s.Replace(Environment.NewLine + "</b>", "</b>" + Environment.NewLine);
s = s.Replace(Environment.NewLine + "</u>", "</u>" + Environment.NewLine);