c# - Convert Unicode string made up of culture-specific digits to integer value -
i developing program in marathi language. in it, want add/validate numbers entered in marathi unicode getting actual integer value.
for example, in marathi:
- ४५ = 45
- ९९ = 99
how convert marathi string "४५"
actual integer value i.e. 45
?
i googled lot, found nothing useful. tried using system.text.encoding.unicode.getstring()
string , tried parse, failed here also.
correct way use char.getnumericvalue lets convert individual characters corresponding numeric values , construct complete value. i.e. char.getnumericvalue('९')
gives 9.
depending on goal may easier replace each national digit character corresponding invariant digit , use regular parsing functions.
int32.parse("९९".replace("९", "9"))
Comments
Post a Comment