mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-24 20:22:41 +01:00
[StringExtensions] - Minor optimization for ContainsLetter().
This commit is contained in:
parent
294b3f646e
commit
ea42ec4184
@ -153,13 +153,14 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
|
|
||||||
public static bool ContainsLetter(this string s)
|
public static bool ContainsLetter(this string s)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(s))
|
if (s != null)
|
||||||
return false;
|
|
||||||
|
|
||||||
foreach (var c in s)
|
|
||||||
{
|
{
|
||||||
if (char.IsLetter(c))
|
foreach (var index in StringInfo.ParseCombiningCharacters(s))
|
||||||
return true;
|
{
|
||||||
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user