Exemple #1
0
 // Get the numeric value of a character.
 public static double GetNumericValue(char ch)
 {
     if (ch >= '0' && ch <= '9')
     {
         return((double)(int)(ch - '0'));
     }
     else
     {
         return(SysCharInfo.GetNumericValue(ch));
     }
 }
Exemple #2
0
 // Get the digit value of a character.
 public static int GetDigitValue(char ch)
 {
     if (ch >= '0' && ch <= '9')
     {
         return((int)(ch - '0'));
     }
     else
     {
         double value  = SysCharInfo.GetNumericValue(ch);
         int    ivalue = (int)value;
         if (((double)ivalue) == value)
         {
             return(ivalue);
         }
         return(-1);
     }
 }