This function is very Useful in displaying numbers in Indic Languages.
Input: Any Number in English.
Output: String in Hindi/Any Language Used in the variable devNum.
Environment: Flash/Actionscript 2.0
function fnTranslate(param){
var num = param.toString();
//Assuming the user input is a valid natural number in English.
var devNum:String="०१२३४५६७८९";
//replace this string by Indic/Non-English numerals
var strOut="";
for(i=0;i<num.length;i++){
s=num.charAt(i);
strOut=strOut+devNum.charAt(s);
}
return strOut;
}
Input: Any Number in English.
Output: String in Hindi/Any Language Used in the variable devNum.
Environment: Flash/Actionscript 2.0
function fnTranslate(param){
var num = param.toString();
//Assuming the user input is a valid natural number in English.
var devNum:String="०१२३४५६७८९";
//replace this string by Indic/Non-English numerals
var strOut="";
for(i=0;i<num.length;i++){
s=num.charAt(i);
strOut=strOut+devNum.charAt(s);
}
return strOut;
}
No comments:
Post a Comment