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

GetDigitValue() public static method

public static GetDigitValue ( String s, int index ) : int
s String
index int
return int
        public static int GetDigitValue(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 (InternalGetDigitValue(InternalConvertToUtf32(s, index)));
        }

Same methods

CharUnicodeInfo::GetDigitValue ( char ch ) : int

Usage Example

 /// <summary>Gets the digit value of the numeric character at the specified index of the specified string.</summary>
 /// <returns>The digit value of the numeric character at the specified index of the specified string.-or- -1, if the character at the specified index of the specified string is not a digit.</returns>
 /// <param name="s">The <see cref="T:System.String" /> containing the Unicode character for which to get the digit value. </param>
 /// <param name="index">The index of the Unicode character for which to get the digit value. </param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="s" /> is null. </exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///   <paramref name="index" /> is outside the range of valid indexes in <paramref name="s" />. </exception>
 public static int GetDigitValue(string s, int index)
 {
     if (s == null)
     {
         throw new ArgumentNullException("s");
     }
     return(CharUnicodeInfo.GetDigitValue(s[index]));
 }
All Usage Examples Of System.Globalization.CharUnicodeInfo::GetDigitValue