drwxr-xr-x 2 f012e8f4 w0134aab 4096 Mar 26 12:03 . drwxr-xr-x 6 f012e8f4 w0134aab 4096 Mar 18 10:36 .. -rw-r--r-- 1 f012e8f4 w0134aab 3837 Mar 20 08:45 author.php -rw-r--r-- 1 f012e8f4 w0134aab 745 Mar 18 10:39 backend-errors.php -rw-r--r-- 1 f012e8f4 w0134aab 4392 Mar 31 08:25 meta_boxes.php -rw-r--r-- 1 f012e8f4 w0134aab 6837 Apr 17 09:53 toc.php Convert numbers with toLocaleString (Javascript) – Talha Sariyürek

Convert numbers with toLocaleString (Javascript)

How to Convert Latin to Arabic, Chinese, Hindu etc.

    Inhaltsangabe
  1. What is
  2. To be considered
  3. My application

As part of the programming work for the Islam-Archive project, I encountered the problem of how I could convert the numbers from Latin to Arabic. Then I came across toLocaleString .

What is toLocaleString?

toLocaleString makes it possible to convert numbers into other languages. For example, 2019 will be ٢٠١٩ or २०१९ or ௨௦௧௯. If you want to get directly into the matter, you can do it directly on the MDN page:

To be considered

The only thing you have to keep in mind is that the passed number has actually been declared as Number. This function can not edit strings and automatically convert them to a number.

My application

I have used this function to convert the suras and verse numbers. Thus I have the display of the number once in Latin and once in Arabic.

Topics

Javascript Program react technology Tips translation

Beitrag teilen

WhatsApp it

Folgen Sie uns