From 550b06447a3c00c3a97a564b7c3b546b6c7f29ac Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 26 Feb 2024 07:11:40 +0100 Subject: [PATCH] Add brackets --- .../FixStartWithUppercaseLetterAfterColon.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/libse/Forms/FixCommonErrors/FixStartWithUppercaseLetterAfterColon.cs b/src/libse/Forms/FixCommonErrors/FixStartWithUppercaseLetterAfterColon.cs index 1b2c356e1..8628eee21 100644 --- a/src/libse/Forms/FixCommonErrors/FixStartWithUppercaseLetterAfterColon.cs +++ b/src/libse/Forms/FixCommonErrors/FixStartWithUppercaseLetterAfterColon.cs @@ -87,7 +87,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors char GetClosingPair(char ch) => ch == '<' ? '>' : '}'; } - private bool IsTurkish(string lang) => lang.Equals("tr", StringComparison.OrdinalIgnoreCase); + private static bool IsTurkish(string lang) => lang.Equals("tr", StringComparison.OrdinalIgnoreCase); private static bool CanCapitalize(string input, IFixCallbacks callbacks) { @@ -99,8 +99,13 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors /// private static bool BeginsWithLetter(string input) { - if (input.Length == 0) return false; + if (input.Length == 0) + { + return false; + } + var ch = input[0]; + return char.IsLetter(ch) && char.IsLower(ch); } @@ -109,9 +114,17 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors /// private static bool IsAppleNaming(string input) { - if (string.IsNullOrEmpty(input)) return false; + if (string.IsNullOrEmpty(input)) + { + return false; + } + var len = input.Length; - if (len < 3) return false; + if (len < 3) + { + return false; + } + return input[0] == 'i' && char.IsUpper(input[1]) && char.IsLower(input[2]); } }