Merge pull request #941 from ivandrofly/fix-2

Refactor (src/Logic/Utilities.cs)
This commit is contained in:
Nikolaj Olsson 2015-06-29 20:36:44 +02:00
commit 5243f9aea0

View File

@ -2736,24 +2736,23 @@ namespace Nikse.SubtitleEdit.Logic
text = text.Replace(operatingSystemCommand, string.Empty);
text = text.Replace('\t', ' ');
while (text.Contains(" "))
text = text.Replace(" ", " ");
text = text.Replace(" " + Environment.NewLine, Environment.NewLine);
text = text.Replace(Environment.NewLine + " ", Environment.NewLine);
text = text.FixExtraSpaces();
if (text.EndsWith(' '))
text = text.TrimEnd(' ');
text = text.Substring(0, text.Length - 1);
const string ellipses = "...";
text = text.Replace(". . ..", ellipses);
text = text.Replace(". ...", ellipses);
text = text.Replace(". .. .", ellipses);
text = text.Replace(". . .", ellipses);
text = text.Replace(". ..", ellipses);
text = text.Replace(".. .", ellipses);
// Fix recursive: ...
while (text.Contains("...."))
text = text.Replace("....", ellipses);
text = text.Replace(". . ..", "...");
text = text.Replace(". ...", "...");
text = text.Replace(". .. .", "...");
text = text.Replace(". . .", "...");
text = text.Replace(". ..", "...");
text = text.Replace(".. .", "...");
text = text.Replace("....", "...");
text = text.Replace("....", "...");
text = text.Replace("....", "...");
text = text.Replace(" ..." + Environment.NewLine, "..." + Environment.NewLine);
text = text.Replace(Environment.NewLine + "... ", Environment.NewLine + "...");
text = text.Replace(Environment.NewLine + "<i>... ", Environment.NewLine + "<i>...");