Skip to content

Commit

Permalink
clean code a bit
Browse files Browse the repository at this point in the history
I am not sure about the line 12. I think the difference between both is more clear like this.
  • Loading branch information
aloisdg authored Mar 23, 2017
1 parent a056d05 commit eb110e5
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;

namespace Humanizer.Localisation.NumberToWords
{
Expand All @@ -9,24 +9,18 @@ protected override void CollectPartsUnderAHundred(ICollection<string> parts, ref
if (number == 71)
parts.Add("soixante et onze");
else if (number == 80)
parts.Add(pluralize ? "quatre-vingts" : "quatre-vingt");
parts.Add("quatre-vingt" + (pluralize ? "s" : string.Empty));
else if (number >= 70)
{
var @base = number < 80 ? 60 : 80;
int units = number - @base;
var tens = @base/10;
parts.Add(string.Format("{0}-{1}", GetTens(tens), GetUnits(units, gender)));
var tens = @base / 10;
parts.Add($"{GetTens(tens)}-{GetUnits(units, gender)}");
}
else
base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize);
}

protected override string GetTens(int tens)
{
if (tens == 8)
return "quatre-vingt";

return base.GetTens(tens);
}
protected override string GetTens(int tens) => tens == 8 ? "quatre-vingt" : base.GetTens(tens);
}
}
}

0 comments on commit eb110e5

Please sign in to comment.