I work on a project in C# which requires to use arabic numbers, but then it must store as integer in database, I need a solution to convert arabic numbers into int in C#. An
Unfortunately it is not yet possible to parse the complete string representation by passing in an appropriate IFormatProvider
(maybe in the upcoming versions). However, the char
type has a GetNumericValue
method which converts any numeric Unicode character to a double. For example:
double two = char.GetNumericValue('٢');
Console.WriteLine(two); // prints 2
You could use it to convert one digit at a time.