Skip to content

Commit

Permalink
Merge pull request #1056 from mhmd-azeez/central-kurdish-bug
Browse files Browse the repository at this point in the history
Fix a bug in number to words for central kurdish
  • Loading branch information
clairernovotny authored Apr 24, 2021
2 parents e024189 + 2378d19 commit d389f6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ public class NumberToWordsTests
[InlineData(100, "سەد")]
[InlineData(1000, "هەزار")]
[InlineData(100000, "سەد هەزار")]
[InlineData(100001, "سەد هەزار و یەک")]
[InlineData(101000, "سەد و یەک هەزار")]
[InlineData(1000000, "یەک میلیۆن")]
[InlineData(51000, "پەنجا و یەک هەزار")]
[InlineData(151000, "سەد و پەنجا و یەک هەزار")]
[InlineData(10000000, "دە میلیۆن")]
[InlineData(100000000, "سەد میلیۆن")]
[InlineData(1000000000, "یەک میلیارد")]
[InlineData(111, "سەد و یازدە")]
[InlineData(1111, "هەزار و سەد و یازدە")]
[InlineData(111111, "سەد و یازدە هەزار و سەد و یازدە")]
[InlineData(1001001, "یەک میلیۆن و هەزار و یەک")]
[InlineData(1001001, "یەک میلیۆن و یەک هەزار و یەک")]
[InlineData(1111111, "یەک میلیۆن و سەد و یازدە هەزار و سەد و یازدە")]
[InlineData(11111111, "یازدە میلیۆن و سەد و یازدە هەزار و سەد و یازدە")]
[InlineData(111111111, "سەد و یازدە میلیۆن و سەد و یازدە هەزار و سەد و یازدە")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public override string Convert(long number)
parts.Add(KurdishUnitsMap[number]);
}

return string.Join(" و ", parts).Replace("یەک هەزار", "هەزار");
var sentence = string.Join(" و ", parts);
if (sentence.StartsWith("یەک هەزار"))
return sentence.Substring(" یەک".Length);
else
return sentence;
}

public override string ConvertToOrdinal(int number)
Expand Down

0 comments on commit d389f6d

Please sign in to comment.