Appearance
NumbertoWord Plugin
A Service for converting numbers to words in both Nepali and English using the Nepali numbering system. Supports negative numbers, decimals, and currency conversion up to Kharaab/खर्ब.
Features
- Bilingual Support: Convert numbers to words in Nepali or English
- Nepali Numbering System: Supports Hundred, Thousand, Lakh, Crore, Arab, and Kharaab
- Negative Numbers: Handles negative values with proper prefix
- Decimal Support: Converts decimals as Paisa (currency mode) or Point (standard mode)
- Currency Mode: Optional currency formatting with Rupees and Paisa
- Large Numbers: Handles values up to 99,99,99,99,99,999 (Kharaab range)
Service Reference
numToWord
Converts a numeric value into its word representation.
typescript
numToWord(
input: number | string,
nepali?: boolean,
currencyConverter?: boolean
): stringParameters
| Parameter | Type | Default | Description |
|---|---|---|---|
input | number | string | - | The numeric value to convert |
nepali | boolean | false | Whether to output in Nepali or English |
currencyConverter | boolean | true | Whether to format as currency (Rupees/Paisa) or standard (Point) |
Returns
string - The number expressed in words
Usage Examples
Using the Plugin in Vue Components
The number to words converter is available as a global plugin in Vue components via $numToWords:
vue
<template>
<div>
<!-- English currency format -->
<p>{{ $numToWords(1234567.5) }}</p>
<!-- Output: Twelve Lakh Thirty Four Thousand Five Hundred Sixty Seven Rupees Fifty Paisa -->
<!-- Nepali currency format -->
<p>{{ $numToWords(1234567.5, true) }}</p>
<!-- Output: बाह्र लाख चौँसठी हजार पाँच सय सड़सठ रुपैयाँ पचास पैसा -->
<!-- English standard format -->
<p>{{ $numToWords(123.456, false, false) }}</p>
<!-- Output: One Hundred Twenty Three Point Four Five Six -->
</div>
</template>
<script setup lang="ts"></script>Using the Function Export
You can also import and use the converter directly:
typescript
import { numToWord } from 'dolphin-components';
// English currency format (default)
numToWord(1234567.5);
// Output: "Twelve Lakh Thirty Four Thousand Five Hundred Sixty Seven Rupees Fifty Paisa"
// Nepali currency format
numToWord(1234567.5, true);
// Output: "बाह्र लाख चौँसठी हजार पाँच सय सड़सठ रुपैयाँ पचास पैसा"
// English standard format (non-currency)
numToWord(123.456, false, false);
// Output: "One Hundred Twenty Three Point Four Five Six"English Examples
typescript
import { numToWord } from 'dolphin-components';
// Basic numbers
numToWord(0);
// Output: "Zero"
numToWord(19);
// Output: "Nineteen Rupees"
numToWord(100);
// Output: "One Hundred Rupees"
// Thousands
numToWord(1500);
// Output: "One Thousand Five Hundred Rupees"
// Lakhs
numToWord(150000);
// Output: "One Lakh Fifty Thousand Rupees"
// Crores
numToWord(15000000);
// Output: "One Crore Fifty Lakh Rupees"
// With decimals
numToWord(1234.75);
// Output: "One Thousand Two Hundred Thirty Four Rupees Seventy Five Paisa"Nepali Examples
typescript
import { numToWord } from 'dolphin-components';
// Basic numbers
numToWord(0, true);
// Output: "शून्य"
numToWord(19, true);
// Output: "उन्नाइस रुपैयाँ"
numToWord(100, true);
// Output: "एक सय रुपैयाँ"
// Thousands
numToWord(1500, true);
// Output: "एक हजार पाँच सय रुपैयाँ"
// Lakhs
numToWord(150000, true);
// Output: "एक लाख पचास हजार रुपैयाँ"
// Crores
numToWord(15000000, true);
// Output: "एक करोड पचास लाख रुपैयाँ"
// With decimals
numToWord(1234.75, true);
// Output: "एक हजार दुई सय चौंतीस रुपैयाँ पचहत्तर पैसा"Negative Numbers
typescript
import { numToWord } from 'dolphin-components';
// Negative in English
numToWord(-500);
// Output: "Negative Five Hundred Rupees"
// Negative in Nepali
numToWord(-500, true);
// Output: "ऋण पाँच सय रुपैयाँ"Standard (Non-Currency) Mode
typescript
import { numToWord } from 'dolphin-components';
// English with decimal points
numToWord(123.456, false, false);
// Output: "One Hundred Twenty Three Point Four Five Six"
// Nepali with decimal points
numToWord(123.456, true, false);
// Output: "एक सय तेइस दश चार पाँच छ"Large Numbers
typescript
import { numToWord } from 'dolphin-components';
// Arab (100 Crore)
numToWord(1000000000);
// Output: "One Arab Rupees"
// Kharaab (100 Arab)
numToWord(100000000000);
// Output: "One Kharaab Rupees"
// Maximum supported
numToWord(999999999999.99);
// Output: "Nine Kharaab Ninety Nine Arab Ninety Nine Crore Ninety Nine Lakh Ninety Nine Thousand Nine Hundred Ninety Nine Rupees Ninety Nine Paisa"Nepali Numbering System
The converter uses the Nepali numbering system with the following place values:
| Place Value | English | Nepali | Value |
|---|---|---|---|
| 1 | One | एक | 1 |
| 10 | Ten | दश | 10 |
| 100 | Hundred | सय | 100 |
| 1,000 | Thousand | हजार | 1,000 |
| 1,00,000 | Lakh | लाख | 100,000 |
| 1,00,00,000 | Crore | करोड | 10,000,000 |
| 1,00,00,00,000 | Arab | अर्ब | 1,000,000,000 |
| 1,00,00,00,00,000 | Kharaab | खर्ब | 100,000,000,000 |
Grouping Pattern
- Last 3 digits: Hundreds (1-999)
- Next 2 digits: Thousands (1,000-99,000)
- Next 2 digits: Lakhs (1,00,000-99,00,000)
- Next 2 digits: Crores (1,00,00,000-99,00,00,000)
- Next 2 digits: Arab (1,00,00,00,000-99,00,00,00,000)
- Next 2 digits: Kharaab (1,00,00,00,00,000+)
Example: 12,34,56,789 = Twelve Crore Thirty Four Lakh Fifty Six Thousand Seven Hundred Eighty Nine
Common Use Cases
- Invoice Generation: Convert amounts to words on invoices and receipts
- Check Writing: Generate written amounts for bank checks
- Financial Reports: Display amounts in both numeric and word format
- Legal Documents: Express monetary values in words for contracts
- Educational Tools: Teaching number systems and language
- Multilingual Applications: Support both English and Nepali speaking users
- Accounting Software: Display human-readable amounts
- Banking Applications: Transaction amount verification
Error Handling
- Empty or null values return empty string
- Invalid numbers return empty string
- Non-numeric strings return empty string
- Decimal places beyond 2 digits are handled gracefully in currency mode
- All decimal digits are converted in standard mode