Nothing seems to be parsing the crap out of *this* number

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)


no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2010/11/12 Suddenly, in a bit more time than a blink of an eye, "standards support" becomes "less i18n support"

2008/10/02 When swimming in a sea of CONTEXT, applications can drown (and there is no lifeguard)

2007/03/01 That's funny, they look like digits!

2007/02/19 Ever wonder why no one bothers to fold digits?

go to newer or older post, or back to index or month or day