nepali_numbers_pro_max 1.0.0 copy "nepali_numbers_pro_max: ^1.0.0" to clipboard
nepali_numbers_pro_max: ^1.0.0 copied to clipboard

Production-grade Nepali number / NPR currency library for Dart & Flutter. Devanagari ↔ ASCII digits, Indian-style lakh/crore/arab grouping, NPR formatting, number → words (एक करोड पच्चीस लाख…), words [...]

nepali_numbers_pro_max #

Production-grade नेपाली number / NPR currency library for Dart & Flutter.

Dart port of the nepali-numbers-pro-max TypeScript library.

Features #

  • Devanagari ↔ ASCII digits१२३४1234, string-preserving
  • Indian-style grouping1,23,45,678 (3-2-2-2), plus Western 12,345,678
  • NPR formattingRs. / रु. / / NPR, accounting & compact styles
  • Number → wordsएक करोड पच्चीस लाख / one crore twenty-five lakh, up to महाशंख (10²¹)
  • Words → number — parse Nepali & English (Indian-system) words back to BigInt
  • Cheque formatsरु. एक लाख पचास हजार रुपैयाँ पचास पैसा मात्र and English equivalents
  • Paisa-safe arithmetic — BigInt-backed; 0.1 + 0.2 == 0.3, always
  • NepaliMoney class — immutable, chainable, allocate (split bills) support
  • Ordinals, fractions, percentages, compactपहिलो, आधा, १.३ लाख, पच्चीस प्रतिशत
  • Amount parsing'रु. १२,३४,५६७.८९' → paisa-precise structured data

Zero dependencies. Pure Dart — works on Flutter (Android, iOS, web, desktop) and server-side.

Install #

dependencies:
  nepali_numbers_pro_max: ^1.0.0

Quick Start #

import 'package:nepali_numbers_pro_max/nepali_numbers_pro_max.dart';

// Digits
toDevanagariDigits('Rs. 1,234.56');   // 'Rs. १,२३४.५६'
toAsciiDigits('रु. १,२३४.५६');        // 'रु. 1,234.56'
detectScript('12३४');                 // DigitScript.mixed

// Grouping (Indian 3-2-2-2)
groupNepali(12345678);                // '1,23,45,678'
groupNepaliDevanagari(12345678);      // '१,२३,४५,६७८'
groupWestern(12345678);               // '12,345,678'

// NPR formatting
formatNPR(1234567.89);                // 'Rs. 12,34,567.89'
formatNPRDevanagari(1234567.89);      // 'रु. १२,३४,५६७.८९'
formatNPRAccounting(-500);            // '(Rs. 500.00)'
formatNPRCompact(150000);             // 'Rs. 1.5L'

// Number → words
toNepaliWords(12500000);              // 'एक करोड पच्चीस लाख'
toEnglishWordsNepaliSystem(12500000); // 'one crore twenty-five lakh'
toNepaliCurrencyWords(1234.56);
// 'एक हजार दुई सय चौँतीस रुपैयाँ छपन्न पैसा मात्र'
toChequeStyleEnglish(1234.56);
// 'One thousand two hundred thirty-four rupees fifty-six paisa Only'

// Words → number
parseNepaliWords('एक करोड पच्चीस लाख');       // BigInt.parse('12500000')
parseNepaliCurrencyWords('एक हजार रुपैयाँ पच्चीस पैसा मात्र');
// RupeePaisa(rupee: 1000, paisa: 25, negative: false)

// String amounts
parseAmount('रु. १२,३४,५६७.८९');
// ParsedAmount(paisa: 123456789, value: 1234567.89, negative: false)
canonicalizeAmount('Rs. 1,234.56');    // '1234.56'

// Paisa-safe arithmetic
addAmount(0.1, 0.2);                   // 0.3  (no FP drift)
splitAmount(10, 3);                    // [3.34, 3.33, 3.33] — sums to exactly 10

// NepaliMoney — immutable & chainable
NepaliMoney.fromRupees(1000).add(250).multiply(1.13).formatNPR();
// 'Rs. 1,412.50'
NepaliMoney.fromRupees(10).allocate(3); // [Rs. 3.34, Rs. 3.33, Rs. 3.33]

// Compact / percent / ordinal / fraction
formatCompactNepali(125000);           // '१.३ लाख'
formatPercentDevanagari(25);           // '२५%'
toNepaliOrdinal(1);                    // 'पहिलो'
fractionToNepaliWords(3, 4);           // 'तीन चौथाइ'

Scales Supported #

Power English Nepali
10³ thousand हजार
10⁵ lakh लाख
10⁷ crore करोड
10⁹ arab अर्ब
10¹¹ kharab खर्ब
10¹³ neel नील
10¹⁵ padma पद्म
10¹⁷ shankh शंख
10¹⁹ mahashankh महाशंख

Pass BigInt for values beyond double precision (±2⁵³).

Rounding Modes #

RoundingMode.halfUp (default) · halfEven (banker's) · halfDown · ceil · floor · trunc

All money math happens in integer paisa (BigInt), so 0.1 + 0.2 is exactly 0.3 and bill splits never lose a paisa.

License #

MIT — see LICENSE.

0
likes
140
points
106
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Production-grade Nepali number / NPR currency library for Dart & Flutter. Devanagari ↔ ASCII digits, Indian-style lakh/crore/arab grouping, NPR formatting, number → words (एक करोड पच्चीस लाख…), words → number, ordinals, fractions, compact form, paisa-safe BigInt math, and percentages. Zero deps.

Repository (GitHub)
View/report issues

Topics

#nepali #nepali-numbers #currency #devanagari #npr

License

MIT (license)

More

Packages that depend on nepali_numbers_pro_max