System.Globalization.CharUnicodeInfo.GetDecimalDigitValue C# (CSharp) Method

GetDecimalDigitValue() public static method

public static GetDecimalDigitValue ( String s, int index ) : int
s String
index int
return int
        public static int GetDecimalDigitValue(String s, int index) {
            if (s == null) {
                throw new ArgumentNullException("s");
            }
            if (index < 0 || index >= s.Length) {
                throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
            }

            return (InternalGetDecimalDigitValue(InternalConvertToUtf32(s, index)));
        }

Same methods

CharUnicodeInfo::GetDecimalDigitValue ( char ch ) : int

Usage Example

 private static void VerifyNativeDigits(string[] nativeDig, string propertyName)
 {
     if (nativeDig == null)
     {
         throw new ArgumentNullException(propertyName, Environment.GetResourceString("ArgumentNull_Array"));
     }
     if (nativeDig.Length != 10)
     {
         throw new ArgumentException(propertyName, Environment.GetResourceString("Argument_InvalidNativeDigitCount"));
     }
     for (int i = 0; i < nativeDig.Length; i++)
     {
         if (nativeDig[i] == null)
         {
             throw new ArgumentNullException(propertyName, Environment.GetResourceString("ArgumentNull_ArrayValue"));
         }
         if (nativeDig[i].Length != 1)
         {
             if (nativeDig[i].Length != 2)
             {
                 throw new ArgumentException(propertyName, Environment.GetResourceString("Argument_InvalidNativeDigitValue"));
             }
             if (!char.IsSurrogatePair(nativeDig[i][0], nativeDig[i][1]))
             {
                 throw new ArgumentException(propertyName, Environment.GetResourceString("Argument_InvalidNativeDigitValue"));
             }
         }
         if ((CharUnicodeInfo.GetDecimalDigitValue(nativeDig[i], 0) != i) && (CharUnicodeInfo.GetUnicodeCategory(nativeDig[i], 0) != UnicodeCategory.PrivateUse))
         {
             throw new ArgumentException(propertyName, Environment.GetResourceString("Argument_InvalidNativeDigitValue"));
         }
     }
 }
All Usage Examples Of System.Globalization.CharUnicodeInfo::GetDecimalDigitValue