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 :: javascript trim newline 
Javascript :: select a label from jquery using for attribute 
Javascript :: how to remove a class in js after 100 milliseconds 
Javascript :: jquery add attribute 
Javascript :: remove special characters regular expression 
Javascript :: js math round up 
Javascript :: change background colour jquery 
Javascript :: jquery check if input is empty on submit 
Javascript :: CLEAR FORM using jquery 
Javascript :: iseven js 
Javascript :: javascript distance between two points 
Javascript :: cdn opencv.js 
Javascript :: javascript link to go back 
Javascript :: heroicons nextjs 
Javascript :: convert da decimale a hex javascript 
Javascript :: NullInjectorError: No provider for HttpClient! 
Javascript :: disable eslint for react project 
Javascript :: window.href 
Javascript :: write file with deno 
Javascript :: jquery onclick function 
Javascript :: view engine setup express 
Javascript :: listen prop change vuejs 
Javascript :: append li to ul javascript 
Javascript :: react native navigation hide navbar 
Javascript :: js string only positive float numbers 
Javascript :: create a new input with type checkbox javascript 
Javascript :: error java.io.filenotfoundexception tessdata/eng.traineddata 
Javascript :: how to convert number to array in javascript using Array.from 
Javascript :: js check string for pangram 
Javascript :: if string has number javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =