Merge pull request #7976 from ivandrofly/feature/add-missing-quote

Refactor quotes replacement in FixCommonErrors
This commit is contained in:
Nikolaj Olsson 2024-02-26 09:38:35 +01:00 committed by GitHub
commit b77e613f6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}
}