/iramount

digit grouping and conversion to formal spoken format for persian numbers

Primary LanguageKotlin

Download HitCount

repositories {
	jcenter()
}
	
implementation 'io.github.the724:iramount:[latest-version]'

This library enables you to create formal Farsi spoken format for numbers that represent an amount in Rials (IRR).

To group digits by three, use

val amount = IrAmount(5511255) // we assume the number is in Rials!
val withDigitGrouping = amount.digitGrouped() // returns 5,511,255

To display Farsi spoken format in Rials (IRR), use

val amount = IrAmount(5511255) // we assume the number is in Rials!
val rialFormat = amount.farsiFormatRial() // returns پنج میلیون و پانصد و یازده هزار و دویست و پتجاه و پنج ریال

To display Farsi spoken format in Tomans, use

val amount = IrAmount(5511255) // we assume the number is in Rials!
val tomanFormat = amount.farsiFormatToman() // returns پانصد و پنجاه و یک هزار و صد و بیست و پنج تومان و پنج ریال

License

Copyright (C) 2019  Farhad Faghihi

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.