Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert english number to bangla

var finalEnglishToBanglaNumber = {
   0: "০",
   1: "১",
   2: "২",
   3: "৩",
   4: "৪",
   5: "৫",
   6: "৬",
   7: "৭",
   8: "৮",
   9: "৯",
};

String.prototype.getDigitBanglaFromEnglish = function () {
   var retStr = this;
   for (var x in finalEnglishToBanglaNumber) {
      retStr = retStr.replace(
         new RegExp(x, "g"),
         finalEnglishToBanglaNumber[x]
      );
   }
   return retStr;
};

var english_number = "123456";

var bangla_converted_number = english_number.getDigitBanglaFromEnglish();

//outputs : ১২৩৪৫৬

console.log(bangla_converted_number); //or alert(bangla_converted_number);

// another reference
// https://stackoverflow.com/questions/30629242/javascript-replace-to-english-number
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascrip reverse text 
Javascript :: how to remove cors error from node app 
Javascript :: pass header in ajax 
Javascript :: node js procfile heroku starter 
Javascript :: set width screen angular 
Javascript :: js this binding setinterval 
Javascript :: change attribute 
Javascript :: javscript remove last character 
Javascript :: redirect in netlify react 
Javascript :: add bootstrap to react,.........,,,, 
Javascript :: settimeout node js 
Javascript :: write to file js 
Javascript :: how to remove https link from javascript 
Javascript :: Error: Material-UI: The data grid component requires all rows to have a unique id property. 
Javascript :: javascript get first 2 char 
Javascript :: javascript get current time with hours and minutes 
Javascript :: js find lowest number in array 
Javascript :: chart js title 
Javascript :: how to check element has an attribute js 
Javascript :: js startswith 
Javascript :: how to remove a class from element with javascript 
Javascript :: getelementbyclass 
Javascript :: select all children javascript 
Javascript :: javascript copy text to clipboard 
Javascript :: get all mondays in calendar+js 
Javascript :: change onclick attribute with javascrip 
Javascript :: cut array up javascript 
Javascript :: stop a video jquery 
Javascript :: Node.js: printing to console without a trailing newline 
Javascript :: javascript search on docuemt for text on iframe 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =