mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-24 20:22:41 +01:00
Merge pull request #1935 from ivandrofly/se
[StringExtensions] - Minor optimization for ContainsLetter().
This commit is contained in:
commit
e5691b7a15
@ -153,13 +153,14 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
public static bool ContainsLetter(this string s)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(s))
|
||||
return false;
|
||||
|
||||
foreach (var c in s)
|
||||
if (s != null)
|
||||
{
|
||||
if (char.IsLetter(c))
|
||||
return true;
|
||||
foreach (var index in StringInfo.ParseCombiningCharacters(s))
|
||||
{
|
||||
var uc = CharUnicodeInfo.GetUnicodeCategory(s, index);
|
||||
if (uc == UnicodeCategory.LowercaseLetter || uc == UnicodeCategory.UppercaseLetter || uc == UnicodeCategory.TitlecaseLetter || uc == UnicodeCategory.ModifierLetter || uc == UnicodeCategory.OtherLetter)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user