Skip to content

Instantly share code, notes, and snippets.

@leppie
Created April 2, 2013 15:53
Show Gist options
  • Save leppie/5293332 to your computer and use it in GitHub Desktop.
Save leppie/5293332 to your computer and use it in GitHub Desktop.
Scheme Unicode identifiers
private static bool IsLetterOrUnicodeSchemeIdentifier(char num)
{
if (num < '\x0080')
{
return char.IsLetter(num);
}
switch (char.GetUnicodeCategory(num))
{
case UnicodeCategory.UppercaseLetter:
case UnicodeCategory.LowercaseLetter:
case UnicodeCategory.TitlecaseLetter:
case UnicodeCategory.ModifierLetter:
case UnicodeCategory.OtherLetter:
case UnicodeCategory.NonSpacingMark:
case UnicodeCategory.SpacingCombiningMark:
case UnicodeCategory.EnclosingMark:
case UnicodeCategory.DecimalDigitNumber:
case UnicodeCategory.LetterNumber:
case UnicodeCategory.OtherNumber:
case UnicodeCategory.PrivateUse:
case UnicodeCategory.ConnectorPunctuation:
case UnicodeCategory.DashPunctuation:
case UnicodeCategory.OtherPunctuation:
case UnicodeCategory.MathSymbol:
case UnicodeCategory.CurrencySymbol:
case UnicodeCategory.ModifierSymbol:
case UnicodeCategory.OtherSymbol:
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment