mirror of https://github.com/adamdruppe/arsd.git
improve number readability and stop dscanner from complaining
This commit is contained in:
parent
ea9f199b29
commit
4b750685b1
20
english.d
20
english.d
|
@ -49,34 +49,34 @@ string numberToEnglish(long number) {
|
|||
if(number)
|
||||
word ~= "-";
|
||||
}
|
||||
} else if(number < 1000) {
|
||||
} else if(number < 1_000) {
|
||||
auto hundreds = number / 100;
|
||||
word ~= onesPlaceWords[cast(int) hundreds] ~ " hundred";
|
||||
number = number % 100;
|
||||
if(number)
|
||||
word ~= " and ";
|
||||
} else if(number < 1000000) {
|
||||
auto thousands = number / 1000;
|
||||
} else if(number < 1_000_000) {
|
||||
auto thousands = number / 1_000;
|
||||
word ~= numberToEnglish(thousands) ~ " thousand";
|
||||
number = number % 1000;
|
||||
number = number % 1_000;
|
||||
if(number)
|
||||
word ~= ", ";
|
||||
} else if(number < 1_000_000_000) {
|
||||
auto millions = number / 1000000;
|
||||
auto millions = number / 1_000_000;
|
||||
word ~= numberToEnglish(millions) ~ " million";
|
||||
number = number % 1000000;
|
||||
number = number % 1_000_000;
|
||||
if(number)
|
||||
word ~= ", ";
|
||||
} else if(number < 1_000_000_000_000) {
|
||||
auto n = number / 1000000000;
|
||||
auto n = number / 1_000_000_000;
|
||||
word ~= numberToEnglish(n) ~ " billion";
|
||||
number = number % 1000000000;
|
||||
number = number % 1_000_000_000;
|
||||
if(number)
|
||||
word ~= ", ";
|
||||
} else if(number < 1_000_000_000_000_000) {
|
||||
auto n = number / 1000000000000;
|
||||
auto n = number / 1_000_000_000_000;
|
||||
word ~= numberToEnglish(n) ~ " trillion";
|
||||
number = number % 1000000000000;
|
||||
number = number % 1_000_000_000_000;
|
||||
if(number)
|
||||
word ~= ", ";
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue