DEV Community

Joodi
Joodi

Posted on

3 2 2 2 2

Convert Numbers to Persian with the ToPersianNumber Library

If you're working on React.js or Next.js projects and need to display numbers in Persian format, the ToPersianNumber library is exactly what you need! This simple, lightweight, and effective library converts English numbers into Persian numerals with ease, allowing you to enhance the user experience for Persian-speaking audiences.

Image description

Why ToPersianNumber?

Simple and Lightweight: This library does just one thing—converts English numbers to Persian—and it does it perfectly. No extra complexity, no bloat.

Perfect for React.js and Next.js Projects: Easily integrate this library into your React and Next.js apps.

Fast and Efficient: While simple, it performs its job quickly and accurately, making it ideal for any project that requires number localization.

How to Use**

  1. Install the library using npm:
npm install topersiannumber
Enter fullscreen mode Exit fullscreen mode

Or using Yarn:

yarn add topersiannumber
Enter fullscreen mode Exit fullscreen mode
  1. Import and use it in your project:
import { ToPersianNumber } from 'topersiannumber';

// Converting a number
const persianFormattedNumber = ToPersianNumber(123456); // Outputs: ١٢٣٤٥٦
console.log(persianFormattedNumber);

Enter fullscreen mode Exit fullscreen mode

Your Support Means a Lot!
This is my first library, and I’d really appreciate your support! Feel free to star the repo and share it with others who might find it useful.

You can find the full repository here.

📦 Check it out on npm 📦

Happy coding! 🚀

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay