Skip to content

Instantly share code, notes, and snippets.

View shubhamkhuva's full-sized avatar
🎯
Focusing

Shubham Khuva shubhamkhuva

🎯
Focusing
  • Mashreq Bank
  • Dubai, United Arab Emirates
  • 05:43 (UTC +04:00)
  • LinkedIn in/shubham-khuva
View GitHub Profile
@shubhamkhuva
shubhamkhuva / indian_currency_converter_in_words.ts
Last active September 29, 2023 08:59
This code snippet provides a utility for converting numerical values into their textual representation in the Indian number format, commonly used for currency amounts.
export const getNumbersToWord = (numbers: any) => {
// stores word representation of given number n
let inWords = '';
// handles digits at ten millions and hundred
// millions places (if any)
inWords += getTranslatedNumber(Math.floor(numbers / 10000000), 'Crore ');
// handles digits at hundred thousands and one
// millions places (if any)
inWords += getTranslatedNumber(Math.floor(numbers / 100000) % 100, 'Lakh ');
// handles digits at thousands and tens thousands