0.0
The project is in a healthy, maintained state
This gem provides methods to convert numbers to Persian text, handling both cardinal and ordinal numbers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

rbnum2persian

A Ruby gem for converting numbers to Persian text, handling both cardinal and ordinal numbers.

Installation

Add this line to your application's Gemfile:

gem 'rbnum2persian'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install rbnum2persian

Usage

Basic Conversion

To convert a number to its Persian text equivalent:

require 'rbnum2persian'
puts Rbnum2persian.num2persian(5678)  # Output: پنج هزار و ششصد و هفتاد و هشت
Handling Persian Digits

If your input includes Persian or Arabic digits:

puts Rbnum2persian.num2persian('٥٦٧٨')  # Output: پنج هزار و ششصد و هفتاد و هشت

Ordinal numbers

To convert to ordinal form:

puts Rbnum2persian.num2persian(5678, 0, true)  # Output: پنج هزار و ششصد و هفتاد و هشتم