public static bool IsNumber(string s, int index) { if (s == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); } if (((uint)index) >= ((uint)s.Length)) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index); } char c = s[index]; if (IsLatin1(c)) { if (IsAscii(c)) { return(IsInRange(c, '0', '9')); } return(CheckNumber(GetLatin1UnicodeCategory(c))); } return(CheckNumber(CharUnicodeInfo.GetUnicodeCategoryInternal(s, index))); }
public static UnicodeCategory GetUnicodeCategory(string s, int index) { if (s == null) { throw new ArgumentNullException(nameof(s)); } if (((uint)index) >= ((uint)s.Length)) { throw new ArgumentOutOfRangeException(nameof(index)); } if (IsLatin1(s[index])) { return(GetLatin1UnicodeCategory(s[index])); } return(CharUnicodeInfo.GetUnicodeCategoryInternal(s, index)); }
public static bool IsSeparator(string s, int index) { if (s == null) { throw new ArgumentNullException(nameof(s)); } if (((uint)index) >= ((uint)s.Length)) { throw new ArgumentOutOfRangeException(nameof(index)); } char c = s[index]; if (IsLatin1(c)) { return(IsSeparatorLatin1(c)); } return(CheckSeparator(CharUnicodeInfo.GetUnicodeCategoryInternal(s, index))); }
public static bool IsDigit(string s, int index) { if (s == null) { throw new ArgumentNullException(nameof(s)); } if (((uint)index) >= ((uint)s.Length)) { throw new ArgumentOutOfRangeException(nameof(index)); } char c = s[index]; if (IsLatin1(c)) { return(IsInRange(c, '0', '9')); } return(CharUnicodeInfo.GetUnicodeCategoryInternal(s, index) == UnicodeCategory.DecimalDigitNumber); }
public static bool IsUpper(string s, int index) { if (s == null) { throw new ArgumentNullException(nameof(s)); } if (((uint)index) >= ((uint)s.Length)) { throw new ArgumentOutOfRangeException(nameof(index)); } char c = s[index]; if (IsLatin1(c)) { return((Latin1CharInfo[c] & IsUpperCaseLetterFlag) != 0); } return(CharUnicodeInfo.GetUnicodeCategoryInternal(s, index) == UnicodeCategory.UppercaseLetter); }
public static bool IsLetter(string s, int index) { if (s == null) { throw new ArgumentNullException(nameof(s)); } if (((uint)index) >= ((uint)s.Length)) { throw new ArgumentOutOfRangeException(nameof(index)); } char c = s[index]; if (IsAscii(c)) { // The ASCII range doesn't include letters in categories other than "upper" and "lower" return((Latin1CharInfo[c] & (IsUpperCaseLetterFlag | IsLowerCaseLetterFlag)) != 0); } return(CheckLetter(CharUnicodeInfo.GetUnicodeCategoryInternal(s, index))); }