/// <summary>获取位于指定字符串的指定索引位置的数值型字符的数字值。</summary>
/// <returns>位于指定字符串的指定索引位置的数值型字符的数字值。- 或 --1,如果位于指定字符串的指定索引位置的字符不是一个数字。</returns>
/// <param name="s">
/// <see cref="T:System.String" />,包含要获取其数字值的 Unicode 字符。</param>
/// <param name="index">要获取其数字值的 Unicode 字符的索引。</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="s" /> 为 null。</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> 超出了 <paramref name="s" /> 中的有效索引范围。</exception>
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((int)CharUnicodeInfo.InternalGetDigitValue(CharUnicodeInfo.InternalConvertToUtf32(s, index)));
}