From 4b750685b1d2f4e954cfe29f6e882c49f0cdfed6 Mon Sep 17 00:00:00 2001 From: vabenil Date: Thu, 20 Oct 2022 14:51:09 +0300 Subject: [PATCH] improve number readability and stop dscanner from complaining --- english.d | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/english.d b/english.d index e79225a..2523ce7 100644 --- a/english.d +++ b/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 {