GetDigitValue() 공개 정적인 메소드

public static GetDigitValue ( String s, int index ) : int
s String
index int
리턴 int
 /// <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]));
 }
        /// <summary>Gets the numeric value associated with the specified character.</summary>
        /// <returns>The numeric value associated with the specified character.-or- -1, if the specified character is not a numeric character.</returns>
        /// <param name="ch">The Unicode character for which to get the numeric value. </param>
        public static double GetNumericValue(char ch)
        {
            int digitValue = CharUnicodeInfo.GetDigitValue(ch);

            if (digitValue >= 0)
            {
                return((double)digitValue);
            }
            switch (ch)
            {
            case '⅓':
                return(0.33333333333333331);

            case '⅔':
                return(0.66666666666666663);

            default:
                switch (ch)
                {
                case 'ⅼ':
                    return(50.0);

                case 'ⅽ':
                    return(100.0);

                case 'ⅾ':
                    return(500.0);

                case 'ⅿ':
                    return(1000.0);

                case 'ↀ':
                    return(1000.0);

                case 'ↁ':
                    return(5000.0);

                case 'ↂ':
                    return(10000.0);

                default:
                    switch (ch)
                    {
                    case '৴':
                        return(1.0);

                    case '৵':
                        return(2.0);

                    case '৶':
                        return(3.0);

                    case '৷':
                        return(4.0);

                    default:
                        switch (ch)
                        {
                        case 'Ⅼ':
                            return(50.0);

                        case 'Ⅽ':
                            return(100.0);

                        case 'Ⅾ':
                            return(500.0);

                        case 'Ⅿ':
                            return(1000.0);

                        default:
                            switch (ch)
                            {
                            case '¼':
                                return(0.25);

                            case '½':
                                return(0.5);

                            case '¾':
                                return(0.75);

                            default:
                                switch (ch)
                                {
                                case '௰':
                                    return(10.0);

                                case '௱':
                                    return(100.0);

                                case '௲':
                                    return(1000.0);

                                default:
                                    switch (ch)
                                    {
                                    case 'ᛮ':
                                        return(17.0);

                                    case 'ᛯ':
                                        return(18.0);

                                    case 'ᛰ':
                                        return(19.0);

                                    default:
                                        switch (ch)
                                        {
                                        case '〸':
                                            return(10.0);

                                        case '〹':
                                            return(20.0);

                                        case '〺':
                                            return(30.0);

                                        default:
                                            if (ch == '፼')
                                            {
                                                return(10000.0);
                                            }
                                            if (ch == '⓾' || ch == '❿' || ch == '➉' || ch == '➓')
                                            {
                                                return(10.0);
                                            }
                                            if (ch == '〇')
                                            {
                                                return(0.0);
                                            }
                                            if ('⓫' <= ch && ch < '⓵')
                                            {
                                                return((double)(ch - 'ⓠ'));
                                            }
                                            if ('〡' <= ch && ch < '〪')
                                            {
                                                return((double)(ch - '〠'));
                                            }
                                            if ('㉑' <= ch && ch < '㉠')
                                            {
                                                return((double)(ch - '㈼'));
                                            }
                                            if ('㊱' <= ch && ch < '㋀')
                                            {
                                                return((double)(ch - '㊍'));
                                            }
                                            if (!char.IsNumber(ch))
                                            {
                                                return(-1.0);
                                            }
                                            if (ch < '༳')
                                            {
                                                return(0.5 + (double)ch - 3882.0);
                                            }
                                            if (ch < '፼')
                                            {
                                                return((double)((ch - '፱') * '\n'));
                                            }
                                            if (ch < '⅙')
                                            {
                                                return(0.2 * (double)(ch - '⅔'));
                                            }
                                            if (ch < 'Ⅼ')
                                            {
                                                return((double)(ch - '⅟'));
                                            }
                                            if (ch < 'ⅼ')
                                            {
                                                return((double)(ch - 'Ⅿ'));
                                            }
                                            if (ch < '⑴')
                                            {
                                                return((double)(ch - '⑟'));
                                            }
                                            if (ch < '⒈')
                                            {
                                                return((double)(ch - '⑳'));
                                            }
                                            if (ch < '⒜')
                                            {
                                                return((double)(ch - '⒇'));
                                            }
                                            if (ch < '㆖')
                                            {
                                                return((double)(ch - '㆑'));
                                            }
                                            if (ch < '㈪')
                                            {
                                                return((double)(ch - '㈟'));
                                            }
                                            if (ch < '㊊')
                                            {
                                                return((double)(ch - '㉿'));
                                            }
                                            return(-1.0);
                                        }
                                        break;
                                    }
                                    break;
                                }
                                break;
                            }
                            break;
                        }
                        break;

                    case '৹':
                        return(16.0);
                    }
                    break;
                }
                break;

            case '⅙':
                return(0.16666666666666666);

            case '⅚':
                return(0.83333333333333337);

            case '⅛':
                return(0.125);

            case '⅜':
                return(0.375);

            case '⅝':
                return(0.625);

            case '⅞':
                return(0.875);

            case '⅟':
                return(1.0);
            }
        }