I want to change persian numbers which are saved in variable like this :
string Value=\"۱۰۳۶۷۵۱\";
to
string Value=\"1036751\"
use this static class to change normalize number easily:
public static class Numbers
{
public static string ChangeToEnglishNumber(this string text)
{
var englishNumbers = string.Empty;
for (var i = 0; i < text.Length; i++)
{
if(char.IsNumber(text[i])) englishNumbers += char.GetNumericValue(text, i);
else englishNumbers += text[i];
}
return englishNumbers;
}
}
Sample:
string test = "۱۰۳۶۷۵۱".ChangeToEnglishNumber(); // => 1036751