mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Refactor quotes replacement in FixCommonErrors
Changed the structure and logic of AddMissingQuotes.cs to improve readability and performance. Instead of multiple utility function calls with hardcoded quotes, a constant "doubleQuote" is implemented, and the nested conditions are reorganized for better flow.
This commit is contained in:
parent
1b0d70a562
commit
d5190e44b9
@ -243,14 +243,20 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
return text;
|
||||
}
|
||||
|
||||
if (Utilities.CountTagInText(text, "\"") == 1 && Utilities.CountTagInText(text, "”") == 1)
|
||||
const string doubleQuote = "\"";
|
||||
if (Utilities.CountTagInText(text, doubleQuote) == 1)
|
||||
{
|
||||
return text.Replace("”", "\"");
|
||||
}
|
||||
if (Utilities.CountTagInText(text, "\"") == 1 && Utilities.CountTagInText(text, "“") == 1)
|
||||
{
|
||||
return text.Replace("“", "\"");
|
||||
if (Utilities.CountTagInText(text, "”") == 1)
|
||||
{
|
||||
return text.Replace("”", doubleQuote);
|
||||
}
|
||||
|
||||
if (Utilities.CountTagInText(text, "“") == 1)
|
||||
{
|
||||
return text.Replace("“", doubleQuote);
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user