This post originated from an RSS feed registered with .NET Buzz
by Anand M.
Original Post: CharUnicodeInfo
Feed Title: .NET From India
Feed URL: http://www.dotnetindia.com/index.rss
Feed Description: Your daily dose of .NET From India
Before we get into CharUnicodeInfo itself, what is the easy way to type out some data in a different language? Well I usually use the Charmap utility that ships with Windows. If you use the Group by Unicode Subrange option, it is quite easy to choose a particular language and work with it.
All the functions in the CharUnicodeInfo class are static. The three main ones of interest are GetDecimalDigitValue, GetDigitValue and GetNumericValue. The DecimalDigit and the Digit functions as similar except that the decimaldigit function as the name suggests is restricted to the decimal number system, ie, numbers between 0-9. Both these functions return the digit value of the specified character or -1 if the character is not a digit.
The GetNumericValue function returns the numeric value of the character even if it is not a digit.
What is the difference??
Let us take the Tamil number set that I mentioned in my last post. In the classical Tamil case, due to the absense of a 0 character, there are numerical symbols to denote 10s, 100s and 1000s(௰, ௱, ௲ respectively). Thus ௰ has a numeric value of 10, but is not a digit. So GetDigitValue will return -1, while GetNumericValue will return 10.
Similar is the case with ¼(U+00BC). GetDigitValue can make no sense of this, but GetNumericValue will give you 0.25. Same is the Case for the Roman Numeral ââ â (U+216D, Roman Represenation for 100).