I have tried to set Culture and UICulture of the ASP.NET application with no success. Also tried it in C# Windows Application.
System.Globalization.CultureInfo a = new System.Globalization.CultureInfo("fa-IR");
a.NumberFormat.DigitSubstitution = System.Globalization.DigitShapes.NativeNational;
string Q = string.Format(a, "{0}", 1234567890); // Output 1234567890 instead of ٠١٢٣٤٥٦٧٨٩
Is there any part that I missed in the code ?
There is no support in C#/ .Net framework to output numbers with digits other than 0-9 (nor parsing support).
You need to output digits yourself. You should be able to format numbers first using built-in code (to get correct grouping/decimal separtor/currency) and than replace 0-9 with national digits using String.Replace
or map digits to characters you need and join them with String.Join
.
var converted = String.Join("", 123490.ToString().Select(c => "٠١٢٣٤٥٦٧٨٩"[c-'0']));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With