Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

english number to bangla javascript

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 :: how to download image in canvas javascript as named 
Javascript :: remove curly brackets from stringify javascript 
Javascript :: space between react native 
Javascript :: jquery set attribute stack overflow 
Javascript :: javascript convert seconds to minutes seconds 
Javascript :: click all buttons on page javascript 
Javascript :: show password on click button jquery 
Javascript :: seconds to hh mm ss javascript 
Javascript :: path.split is not a function react hook use form 
Javascript :: typescript read url parameters 
Javascript :: jquery datatable destroy and recreate 
Javascript :: jquery video play 
Javascript :: if media query jquery 
Javascript :: hello world javascript 
Javascript :: connection refused xmlhttprequest 
Javascript :: connect mongoose to atlas 
Javascript :: javascript detect dark mode 
Javascript :: ejs comments 
Javascript :: javascript remove space from two side of string 
Javascript :: Failed to transform react-native-reanimated-65.aar 
Javascript :: jest expect async function to throw error 
Javascript :: get actual time jquery 
Javascript :: jquery detect if element has overflow 
Javascript :: first program in node js 
Javascript :: jquery select by data attribute 
Javascript :: jquery get each row in table 
Javascript :: js string for each char 
Javascript :: separate digits in javascript 
Javascript :: how to clear nodemon cache 
Javascript :: javascript generate random string 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =