mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Merge pull request #8349 from ivandrofly/start-with-upper
Refactor method to check string starts with lowercase letter
This commit is contained in:
commit
7b75b154ef
@ -91,22 +91,15 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
|||||||
|
|
||||||
private static bool CanCapitalize(string input, IFixCallbacks callbacks)
|
private static bool CanCapitalize(string input, IFixCallbacks callbacks)
|
||||||
{
|
{
|
||||||
return !IsAppleNaming(input) && BeginsWithLetter(input);
|
return !IsAppleNaming(input) && IsFirstLetterConvertibleToUppercase(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if first character is convertible to uppercase otherwise false
|
/// Returns true if first character is convertible to uppercase otherwise false
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static bool BeginsWithLetter(string input)
|
private static bool IsFirstLetterConvertibleToUppercase(string input)
|
||||||
{
|
{
|
||||||
if (input.Length == 0)
|
return input.Length > 0 && char.IsLower(input[0]);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ch = input[0];
|
|
||||||
|
|
||||||
return char.IsLetter(ch) && char.IsLower(ch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user