by Michael S. Kaplan, published on 2007/02/14 06:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/02/14/1675303.aspx
Balsu asks:
Hi
Is there a way to parse the numbers of other digits in C#?
After changing the culture to Tamil and Parsing like below didn’t solve the issue
int y = Int32.Parse(“௩௲௭௱௮௰௨”,
NumberStyles.Number,
CultureInfo.CurrentCulture.NumberFormat);
௩௲௭௱௮௰௨ is tamil equivalent of 3782.
Thanks!
Bala
Now, there are three responses that occur to me here.
The first is that there is no locale specific number parsing support in either managed or unmanaged code, though I have talked about digit substitution in both kind of code in the past almost obsessively at times. The pieces are in place for the future, but for now you'd have to either use the new NumberFormatInfo properties or call the unmanaged FoldString and just do the substitution yourself.
The second is that the form of Tamil being discussed is not to do with treating Tamil numbers as digits....
The third is that the older use of Tamil numbers (that I described in In Tamil -- sometimes, they are digits; other times, just numbers) is highly unlikely to really be added as a core supported mechnism here -- it is sdimply not commonly used at this point in time. Do if you want 3782 then ௩௭௮௨ is muh more likely to be what people would be expecting (though the algorithm would be easy enough to code up!).
The same thing probably applies to romn numerals, as well.
Ethiopic, on the other hand, may be put in the more commonly used category, and there is some indication that its usage in date and calendar formatting and as an option in number formatting might make sense (more info in Why that is positively Ethiopic!). But thus far other number systems just seem to be not so common these days....
This post brought to you by ௲ (U+0bf2, a.k.a. TAMIL NUMBER ONE THOUSAND)
referenced by