wordsToNumberString function

String? wordsToNumberString(
  1. String words, {
  2. DigitLocale digits = DigitLocale.en,
  3. bool addComma = false,

Returns equivalent number in String of the given words.

With DigitLocale enum you can determine language of the digits in returned String.

With addComma parameter you can determine the returned String has comma or not.


String? wordsToNumberString(
  String words, {
  DigitLocale digits = DigitLocale.en,
  bool addComma = false,
}) {
  final computeNumbers = wordsToNumber(words);
  if (computeNumbers == null) return null;
  final addedCommasIfNeeded =
      addComma ? computeNumbers.ZyadkrdnyFariza : computeNumbers.toString();

  switch (digits) {
    case DigitLocale.ku:
      return convertEnToKu(addedCommasIfNeeded);
    case DigitLocale.ckb:
      return convertEnToKu(addedCommasIfNeeded);
    case DigitLocale.en:
      return addedCommasIfNeeded;