Numbers in words
import { numberToWords, amountInWords } from 'pakdatakit/words'
Writes numbers the way they are said in Pakistan: hundred, thousand, lakh, crore, arab and kharab, not million and billion. amountInWords() adds rupees and paisa, as on cheques and invoices, in English or Urdu.
one lakh twenty-five thousand rupees and fifty paisa
- In words
- one lakh twenty-five thousand rupees and fifty paisa
- Cheque style
- Rupees One Lakh Twenty-Five Thousand and Fifty Paisa Only
Examples
Section titled “Examples”import { numberToWords, amountInWords } from 'pakdatakit';
numberToWords(12500000);// → 'one crore twenty-five lakh'
amountInWords(125000.5);// → 'one lakh twenty-five thousand rupees and fifty paisa'
amountInWords(125000, { cheque: true });// → 'Rupees One Lakh Twenty-Five Thousand Only'
amountInWords(125000, { language: 'ur', cheque: true });// → 'ایک لاکھ پچیس ہزار روپے صرف'from pakdatakit import number_to_words, amount_in_words
number_to_words(12_500_000)# → 'one crore twenty-five lakh'
amount_in_words(125000.5)# → 'one lakh twenty-five thousand rupees and fifty paisa'
amount_in_words(125_000, cheque=True)# → 'Rupees One Lakh Twenty-Five Thousand Only'
amount_in_words(125_000, language='ur', cheque=True)# → 'ایک لاکھ پچیس ہزار روپے صرف'import 'package:pakdatakit/pakdatakit.dart';
numberToWords(12500000);// → 'one crore twenty-five lakh'
amountInWords(125000.5);// → 'one lakh twenty-five thousand rupees and fifty paisa'
amountInWords(125000, cheque: true);// → 'Rupees One Lakh Twenty-Five Thousand Only'
amountInWords(125000, language: WordsLanguage.ur, cheque: true);// → 'ایک لاکھ پچیس ہزار روپے صرف'using PakDataKit;
Words.NumberToWords(12500000);// → "one crore twenty-five lakh"
Words.AmountInWords(125000.5);// → "one lakh twenty-five thousand rupees and fifty paisa"
Words.AmountInWords(125000, WordsLanguage.En, cheque: true);// → "Rupees One Lakh Twenty-Five Thousand Only"
Words.AmountInWords(125000, WordsLanguage.Ur, cheque: true);// → "ایک لاکھ پچیس ہزار روپے صرف"use PakDataKit\Words;
Words::numberToWords(12_500_000);// → 'one crore twenty-five lakh'
Words::amountInWords(125000.5);// → 'one lakh twenty-five thousand rupees and fifty paisa'
Words::amountInWords(125_000, 'en', cheque: true);// → 'Rupees One Lakh Twenty-Five Thousand Only'
Words::amountInWords(125_000, 'ur', cheque: true);// → 'ایک لاکھ پچیس ہزار روپے صرف'Reference
Section titled “Reference”numberToWords()
Section titled “numberToWords()”function numberToWords(n: number, options?: NumberToWordsOptions): string;
type WordsLanguage = 'en' | 'ur';
interface NumberToWordsOptions { language?: WordsLanguage; // default 'en'}Parameters. n: a safe integer; negative numbers start with minus (منفی in Urdu). options.language: 'en' (the default) or 'ur'.
Returns the number in words: numberToWords(125000) is "one lakh twenty-five thousand", and in Urdu ایک لاکھ پچیس ہزار.
Caveats. Throws a RangeError if n is not a safe integer, or if language is not 'en' or 'ur'. In Urdu, every number from 0 to 99 has a word of its own (پچیس for 25), not tens plus ones.
Related: amountInWords().
amountInWords()
Section titled “amountInWords()”function amountInWords(amount: number, options?: AmountInWordsOptions): string;
interface AmountInWordsOptions { language?: WordsLanguage; // default 'en' cheque?: boolean;}Parameters. amount: in PKR, zero or more. options.language: 'en' or 'ur'. options.cheque: cheque style, "Rupees One Lakh Twenty-Five Thousand Only" in English, or the words followed by روپے صرف in Urdu.
Returns the amount in words, with paisa: amountInWords(125000.5) is "one lakh twenty-five thousand rupees and fifty paisa".
Caveats. Amounts are rounded to the nearest paisa. Throws a RangeError if amount is negative, not finite or too large.
Related: numberToWords(), rupee formatting for Rs. 150,000 and 25 Lakh.