mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 19:52:48 +01:00
Merge pull request #941 from ivandrofly/fix-2
Refactor (src/Logic/Utilities.cs)
This commit is contained in:
commit
5243f9aea0
@ -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>...");
|
||||
|
Loading…
Reference in New Issue
Block a user