// 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)); } }
// Initialize the environment state. static Environment() { // Get the newline string. try { newLine = SysCharInfo.GetNewLine(); } catch (NotImplementedException) { // The runtime engine does not have "SysCharInfo". newLine = "\n"; } }
// 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); } }
// Get the unicode category of a character. public static UnicodeCategory GetUnicodeCategory(char ch) { return(SysCharInfo.GetUnicodeCategory(ch)); }