longIndianNumeral method

String longIndianNumeral(
  1. num numericValue
)

Implementation

String longIndianNumeral(num numericValue) {
  if (numericValue >= 100000000000) {
    return "${numericValue ~/ 100000000000} Kharab ${longIndianNumeral(numericValue % 100000000000)}";
  } else if (numericValue >= 1000000000) {
    return "${numericValue ~/ 1000000000} Arab ${longIndianNumeral(numericValue % 1000000000)}";
  } else if (numericValue >= 10000000) {
    return "${numericValue ~/ 10000000} crore ${longIndianNumeral(numericValue % 10000000)}";
  } else if (numericValue >= 100000) {
    return "${numericValue ~/ 100000} lakh ${longIndianNumeral(numericValue % 100000)}";
  } else if (numericValue >= 1000) {
    return "${numericValue ~/ 1000} thousand ${longIndianNumeral(numericValue % 1000)}";
  } else if (numericValue >= 100) {
    return "${numericValue ~/ 100} hundred ${longIndianNumeral(numericValue % 100)}";
  } else if (numericValue >= 20) {
    const List<String> tens = [
      "",
      "",
      "twenty",
      "thirty",
      "forty",
      "fifty",
      "sixty",
      "seventy",
      "eighty",
      "ninety"
    ];
    return "${tens[numericValue ~/ 10]} ${longIndianNumeral(numericValue % 10)}";
  } else if (numericValue >= 1) {
    const List<String> ones = [
      "",
      "one",
      "two",
      "three",
      "four",
      "five",
      "six",
      "seven",
      "eight",
      "nine",
      "ten",
      "eleven",
      "twelve",
      "thirteen",
      "fourteen",
      "fifteen",
      "sixteen",
      "seventeen",
      "eighteen",
      "nineteen"
    ];
    return ones[numericValue.toInt()];
  } else {
    return "";
  }
}