How to convert numbers into Arabic numeric in X++?

static TempStr num2ar(real numerals)
{

#DEFINE.NumDec(2)

str    1        digit;
str   30        numeralsTxt;
str  250        characters;

numeralsTxt= num2str(numerals,0,#NumDec,2,0);
characters= “”;

while (numeralsTxt)
{
digit  = subStr(numeralsTxt,1,1);
numeralsTxt= strDel(numeralsTxt,1,1);

switch(digit)
{
case ‘0’: characters+= ‘.’;
break;
case ‘1’: characters+= ‘۱’;
break;
case ‘2’: characters+= ‘۲’;
break;
case ‘3’: characters+= ‘۳’;
break;
case ‘4’: characters+= ‘٤’;
break;
case ‘5’: characters+= ‘٥’;
break;
case ‘6’: characters+= ‘٦’;
break;
case ‘7’: characters+= ‘٧’;
break;
case ‘8’: characters+= ‘۸’;
break;
case ‘9’: characters+= ‘۹’;
break;

}
characters+= ‘ ‘;
}
return characters;
}

Reference:
http://dynamics365ax2012.blogspot.com/2017/12/how-to-convert-numbers-into-arabic.html

Leave Comment

Your email address will not be published. Required fields are marked *