diff --git a/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs b/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs index b9c1ab20c..1a9cfb41e 100644 --- a/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs @@ -14,7 +14,7 @@ public void CanHumanizeMultipleWordDescriptionAttribute() => [Fact] public void CanHumanizeMultipleValueBitFieldEnum() { - var xoredBitFlag = (BitFieldEnumUnderTest.RED | BitFieldEnumUnderTest.DARK_GRAY); + var xoredBitFlag = BitFieldEnumUnderTest.RED | BitFieldEnumUnderTest.DARK_GRAY; Assert.Equal(BitFlagEnumTestsResources.ExpectedResultWhenBothValuesXored, xoredBitFlag.Humanize()); } @@ -29,7 +29,7 @@ public void CanHumanizeShortMultipleWordDescriptionAttribute() => [Fact] public void CanHumanizeShortMultipleValueBitFieldEnum() { - var xoredBitFlag = (ShortBitFieldEnumUnderTest.RED | ShortBitFieldEnumUnderTest.DARK_GRAY); + var xoredBitFlag = ShortBitFieldEnumUnderTest.RED | ShortBitFieldEnumUnderTest.DARK_GRAY; Assert.Equal(BitFlagEnumTestsResources.ExpectedResultWhenBothValuesXored, xoredBitFlag.Humanize()); } diff --git a/src/Humanizer.Tests.Shared/MetricNumeralTests.cs b/src/Humanizer.Tests.Shared/MetricNumeralTests.cs index 53d2f9edf..caa2397a7 100644 --- a/src/Humanizer.Tests.Shared/MetricNumeralTests.cs +++ b/src/Humanizer.Tests.Shared/MetricNumeralTests.cs @@ -79,7 +79,7 @@ public void TestAllSymbolsAsInt(int exponent) [Theory] [InlineData("0", 0d, false, true, null)] [InlineData("123", 123d, false, true, null)] - [InlineData("-123", (-123d), false, true, null)] + [InlineData("-123", -123d, false, true, null)] [InlineData("1.23k", 1230d, false, true, null)] [InlineData("1 k", 1000d, true, true, null)] [InlineData("1 kilo", 1000d, true, false, null)] diff --git a/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs b/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs index e005fccd8..90ece01ca 100644 --- a/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs +++ b/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs @@ -76,7 +76,7 @@ private static string PrecisionHumanize(TimeSpan ts, Tense tense, double precisi { var factor = Convert.ToInt32(Math.Floor((double)days / 30)); var maxMonths = Convert.ToInt32(Math.Ceiling((double)days / 30)); - months = (days >= 30 * (factor + precision)) ? maxMonths : maxMonths - 1; + months = days >= 30 * (factor + precision) ? maxMonths : maxMonths - 1; } // year calculation @@ -89,7 +89,7 @@ private static string PrecisionHumanize(TimeSpan ts, Tense tense, double precisi { var factor = Convert.ToInt32(Math.Floor((double)days / 365)); var maxMonths = Convert.ToInt32(Math.Ceiling((double)days / 365)); - years = (days >= 365 * (factor + precision)) ? maxMonths : maxMonths - 1; + years = days >= 365 * (factor + precision) ? maxMonths : maxMonths - 1; } // start computing result from larger units to smaller ones diff --git a/src/Humanizer/FluentDate/In.SomeTimeFrom.tt b/src/Humanizer/FluentDate/In.SomeTimeFrom.tt index 8fdc13ddd..6e4a539e4 100644 --- a/src/Humanizer/FluentDate/In.SomeTimeFrom.tt +++ b/src/Humanizer/FluentDate/In.SomeTimeFrom.tt @@ -12,7 +12,7 @@ namespace Humanizer; public partial class In { <#for (var i = 1; i <= 10; i++){ - var plural = ( i > 1 ? "s" : ""); + var plural = i > 1 ? "s" : ""; var second = "Second" + plural; var minute = "Minute" + plural; var hour = "Hour" + plural; diff --git a/src/Humanizer/FluentDate/InDate.SomeTimeFrom.tt b/src/Humanizer/FluentDate/InDate.SomeTimeFrom.tt index 05d08850e..e42d9fd07 100644 --- a/src/Humanizer/FluentDate/InDate.SomeTimeFrom.tt +++ b/src/Humanizer/FluentDate/InDate.SomeTimeFrom.tt @@ -13,7 +13,7 @@ namespace Humanizer; public partial class InDate { <#for (var i = 1; i <= 10; i++){ - var plural = ( i > 1 ? "s" : ""); + var plural = i > 1 ? "s" : ""; var day = "Day" + plural; var week = "Week" + plural; diff --git a/src/Humanizer/HeadingExtensions.cs b/src/Humanizer/HeadingExtensions.cs index 6f9bc26fa..2c1cfd125 100644 --- a/src/Humanizer/HeadingExtensions.cs +++ b/src/Humanizer/HeadingExtensions.cs @@ -37,7 +37,7 @@ public static class HeadingExtensions /// The culture to return the textual representation in public static string ToHeading(this double heading, HeadingStyle style = HeadingStyle.Abbreviated, CultureInfo culture = null) { - var val = (int)((heading / 22.5) + .5); + var val = (int)(heading / 22.5 + .5); var result = Headings[val % 16]; @@ -58,7 +58,7 @@ public static string ToHeading(this double heading, HeadingStyle style = Heading /// The heading arrow. public static char ToHeadingArrow(this double heading) { - var val = (int)((heading / 45) + .5); + var val = (int)(heading / 45 + .5); return HeadingArrows[val % 8]; } @@ -111,7 +111,7 @@ public static double FromHeadingArrow(this char heading) return -1; } - return (index * 45.0); + return index * 45.0; } /// diff --git a/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs index 91b55d56f..90cd7dbd7 100644 --- a/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs @@ -45,25 +45,25 @@ private string Convert(int number, bool isOrdinal) var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add($"{Convert(number / 1000000000)} miljard"); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add($"{Convert(number / 1000000)} miljoen"); number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { parts.Add($"{Convert(number / 1000)} duisend"); number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { parts.Add($"{Convert(number / 100)} honderd"); number %= 100; @@ -85,13 +85,13 @@ private string Convert(int number, bool isOrdinal) } else { - var lastPartValue = (number / 10) * 10; + var lastPartValue = number / 10 * 10; var lastPart = TensMap[number / 10]; - if ((number % 10) > 0) + if (number % 10 > 0) { lastPart = $"{GetUnitValue(number % 10, false)} en {(isOrdinal ? GetUnitValue(lastPartValue, isOrdinal) : lastPart)}"; } - else if ((number % 10) == 0) + else if (number % 10 == 0) { lastPart = $"{(parts.Count > 0 ? "en " : "")}{lastPart}{(isOrdinal ? "ste" : "")}"; } diff --git a/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs index 760779442..054df86bc 100644 --- a/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs @@ -84,7 +84,7 @@ public override string Convert(long number, GrammaticalGender gender, bool addAn else { var ones = tens % 10; - tens = (tens / 10); + tens = tens / 10; if (ones > 0) { diff --git a/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs index a39ff8d49..7dfe98a7e 100644 --- a/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs @@ -52,40 +52,40 @@ private string ConvertImpl(long number, bool isOrdinal) var parts = new List(); - if ((number / 1000000000000000000) > 0) + if (number / 1000000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000000)} քվինտիլիոն"); number %= 1000000000000000000; } - if ((number / 1000000000000000) > 0) + if (number / 1000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000)} կվադրիլիոն"); number %= 1000000000000000; } - if ((number / 1000000000000) > 0) + if (number / 1000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000)} տրիլիոն"); number %= 1000000000000; } - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add($"{Convert(number / 1000000000)} միլիարդ"); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add($"{Convert(number / 1000000)} միլիոն"); number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { - if ((number / 1000) == 1) + if (number / 1000 == 1) { parts.Add("հազար"); } @@ -97,9 +97,9 @@ private string ConvertImpl(long number, bool isOrdinal) number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { - if ((number / 100) == 1) + if (number / 100 == 1) { parts.Add("հարյուր"); } @@ -120,7 +120,7 @@ private string ConvertImpl(long number, bool isOrdinal) else { var lastPart = TensMap[number / 10]; - if ((number % 10) > 0) + if (number % 10 > 0) { lastPart += $"{GetUnitValue(number % 10, isOrdinal)}"; } diff --git a/src/Humanizer/Localisation/NumberToWords/AzerbaijaniNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/AzerbaijaniNumberToWordsConverter.cs index f33536b25..92f2acc2a 100644 --- a/src/Humanizer/Localisation/NumberToWords/AzerbaijaniNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/AzerbaijaniNumberToWordsConverter.cs @@ -37,33 +37,33 @@ public override string Convert(long input) var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add($"{Convert(number / 1000000000)} milyard"); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add($"{Convert(number / 1000000)} milyon"); number %= 1000000; } - var thousand = (number / 1000); + var thousand = number / 1000; if (thousand > 0) { parts.Add($"{(thousand > 1 ? Convert(thousand) : "")} min".Trim()); number %= 1000; } - var hundred = (number / 100); + var hundred = number / 100; if (hundred > 0) { parts.Add($"{(hundred > 1 ? Convert(hundred) : "")} yüz".Trim()); number %= 100; } - if ((number / 10) > 0) + if (number / 10 > 0) { parts.Add(TensMap[number / 10]); number %= 10; diff --git a/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs index f1cf71165..101da9c78 100644 --- a/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs @@ -77,25 +77,25 @@ public override string Convert(long input) var parts = new List(); - if ((number / 10000000) > 0) + if (number / 10000000 > 0) { parts.Add($"{Convert(number / 10000000)} কোটি"); number %= 10000000; } - if ((number / 100000) > 0) + if (number / 100000 > 0) { parts.Add($"{Convert(number / 100000)} লক্ষ"); number %= 100000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { parts.Add($"{Convert(number / 1000)} হাজার"); number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { parts.Add($"{HundredsMap[number / 100]}"); number %= 100; diff --git a/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs index 95d326bfa..32cb2fb92 100644 --- a/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs @@ -31,7 +31,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { // gender is not applied for billions parts.Add(number / 1000000000 >= 2 @@ -41,7 +41,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { // gender is not applied for millions parts.Add(number / 1000000 >= 2 @@ -51,14 +51,14 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { // gender is not applied for thousands parts.Add(number / 1000 == 1 ? "mil" : $"{Convert(number / 1000, GrammaticalGender.Masculine)} mil"); number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { if (number == 100) { @@ -67,7 +67,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd else { // Gender is applied to hundreds starting from 200 - parts.Add(ApplyGender(PortugueseHundredsMap[(number / 100)], gender)); + parts.Add(ApplyGender(PortugueseHundredsMap[number / 100], gender)); } number %= 100; @@ -87,7 +87,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd else { var lastPart = PortugueseTensMap[number / 10]; - if ((number % 10) > 0) + if (number % 10 > 0) { lastPart += $" e {ApplyGender(PortugueseUnitsMap[number % 10], gender)}"; } @@ -109,7 +109,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add(number / 1000000000 == 1 ? ApplyOrdinalGender("bilionésimo", gender) @@ -118,7 +118,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add(number / 1000000 == 1 ? ApplyOrdinalGender("milionésimo", gender) @@ -127,7 +127,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { parts.Add(number / 1000 == 1 ? ApplyOrdinalGender("milésimo", gender) @@ -136,13 +136,13 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { parts.Add(ApplyOrdinalGender(PortugueseOrdinalHundredsMap[number / 100], gender)); number %= 100; } - if ((number / 10) > 0) + if (number / 10 > 0) { parts.Add(ApplyOrdinalGender(PortugueseOrdinalTensMap[number / 10], gender)); number %= 10; diff --git a/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs index 76f7aceaf..30edc6994 100644 --- a/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs @@ -59,7 +59,7 @@ private static string Convert(long input, GrammaticalGender gender, bool isOrdin var lastOrdinalSubstitution = ""; - if ((input / 1000000000000) > 0) + if (input / 1000000000000 > 0) { if (isOrdinal) lastOrdinalSubstitution = Convert(input / 1000000000000, gender, false) + " трилион" + @@ -67,7 +67,7 @@ private static string Convert(long input, GrammaticalGender gender, bool isOrdin input %= 1000000000000; } - if ((input / 1000000000) > 0) + if (input / 1000000000 > 0) { parts.Add(input < 2000000000 ? "един милиард" : Convert(input / 1000000000, gender, false) + " милиарда"); @@ -77,7 +77,7 @@ private static string Convert(long input, GrammaticalGender gender, bool isOrdin input %= 1000000000; } - if ((input / 1000000) > 0) + if (input / 1000000 > 0) { parts.Add(input < 2000000 ? "един милион" : Convert(input / 1000000, gender, false) + " милиона"); @@ -88,7 +88,7 @@ private static string Convert(long input, GrammaticalGender gender, bool isOrdin input %= 1000000; } - if ((input / 1000) > 0) + if (input / 1000 > 0) { if (input < 2000) parts.Add("хиляда"); diff --git a/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs index df4adb350..ab3e0bc25 100644 --- a/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs @@ -8,7 +8,7 @@ internal class CentralKurdishNumberToWordsConverter : GenderlessNumberToWordsCon public override string Convert(long number) { - var largestNumber = (Math.Pow(10, 15) * 1000) - 1; + var largestNumber = Math.Pow(10, 15) * 1000 - 1; if (number > largestNumber || number < -largestNumber) { throw new NotImplementedException(); diff --git a/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs index 63bab29cc..27890a3fe 100644 --- a/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs @@ -26,7 +26,7 @@ private static string Convert(long number, bool isOrdinal, bool isSpecial) var parts = new List(); - if ((number / 1000000000000) > 0) + if (number / 1000000000000 > 0) { var format = "{0}兆"; if (number % 1000000000000 < 100000000000 && number % 1000000000000 > 0) @@ -38,7 +38,7 @@ private static string Convert(long number, bool isOrdinal, bool isSpecial) number %= 1000000000000; } - if ((number / 100000000) > 0) + if (number / 100000000 > 0) { var format = "{0}亿"; if (number % 100000000 < 10000000 && number % 100000000 > 0) @@ -50,7 +50,7 @@ private static string Convert(long number, bool isOrdinal, bool isSpecial) number %= 100000000; } - if ((number / 10000) > 0) + if (number / 10000 > 0) { var format = "{0}万"; if (number % 10000 < 1000 && number % 10000 > 0) @@ -62,7 +62,7 @@ private static string Convert(long number, bool isOrdinal, bool isSpecial) number %= 10000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { var format = "{0}千"; if (number % 1000 < 100 && number % 1000 > 0) @@ -74,7 +74,7 @@ private static string Convert(long number, bool isOrdinal, bool isSpecial) number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { var format = "{0}百"; if (number % 100 < 10 && number % 100 > 0) @@ -95,7 +95,7 @@ private static string Convert(long number, bool isOrdinal, bool isSpecial) else { var lastPart = $"{UnitsMap[number / 10]}十"; - if ((number % 10) > 0) + if (number % 10 > 0) { lastPart += $"{UnitsMap[number % 10]}"; } diff --git a/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs index 0fe5ec67c..9b6e62c0c 100644 --- a/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs @@ -120,7 +120,7 @@ public override string ConvertToOrdinal(int number) // achtste // twintigste, dertigste, veertigste, ... // honderdste, duizendste, ... - if (word.LastIndexOfAny(EndingCharForSte) == (word.Length - 1)) + if (word.LastIndexOfAny(EndingCharForSte) == word.Length - 1) { return word + "ste"; } diff --git a/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs index 15a09d303..d1fa2bb6d 100644 --- a/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs @@ -40,43 +40,43 @@ private string Convert(long number, bool isOrdinal, bool addAnd = true) var parts = new List(); - if ((number / 1000000000000000000) > 0) + if (number / 1000000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000000)} quintillion"); number %= 1000000000000000000; } - if ((number / 1000000000000000) > 0) + if (number / 1000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000)} quadrillion"); number %= 1000000000000000; } - if ((number / 1000000000000) > 0) + if (number / 1000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000)} trillion"); number %= 1000000000000; } - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add($"{Convert(number / 1000000000)} billion"); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add($"{Convert(number / 1000000)} million"); number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { parts.Add($"{Convert(number / 1000)} thousand"); number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { parts.Add($"{Convert(number / 100)} hundred"); number %= 100; @@ -96,7 +96,7 @@ private string Convert(long number, bool isOrdinal, bool addAnd = true) else { var lastPart = TensMap[number / 10]; - if ((number % 10) > 0) + if (number % 10 > 0) { lastPart += $"-{GetUnitValue(number % 10, isOrdinal)}"; } diff --git a/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs index 55e1f306f..bd7c4ea38 100644 --- a/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs @@ -67,7 +67,7 @@ public override string ConvertToOrdinal(int number) if (number % 10 == 3 && number != 13) { - return Convert((number / 10) * 10) + " و سوم"; + return Convert(number / 10 * 10) + " و سوم"; } var word = Convert(number); diff --git a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs index c85e1e218..09b52d78e 100644 --- a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs @@ -31,7 +31,7 @@ public override string Convert(long input) var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add(number / 1000000000 == 1 ? "miljardi " @@ -40,7 +40,7 @@ public override string Convert(long input) number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add(number / 1000000 == 1 ? "miljoona " @@ -49,7 +49,7 @@ public override string Convert(long input) number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { parts.Add(number / 1000 == 1 ? "tuhat " @@ -58,7 +58,7 @@ public override string Convert(long input) number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { parts.Add(number / 100 == 1 ? "sata" @@ -67,7 +67,7 @@ public override string Convert(long input) number %= 100; } - if (number >= 20 && (number / 10) > 0) + if (number >= 20 && number / 10 > 0) { parts.Add($"{Convert(number / 10)}kymmentä"); number %= 10; @@ -104,31 +104,31 @@ private static string ToOrdinal(int number, bool useExceptions) var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { - parts.Add($"{((number / 1000000000) == 1 ? "" : ToOrdinal(number / 1000000000, true))}miljardis"); + parts.Add($"{(number / 1000000000 == 1 ? "" : ToOrdinal(number / 1000000000, true))}miljardis"); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { - parts.Add($"{((number / 1000000) == 1 ? "" : ToOrdinal(number / 1000000, true))}miljoonas"); + parts.Add($"{(number / 1000000 == 1 ? "" : ToOrdinal(number / 1000000, true))}miljoonas"); number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { - parts.Add($"{((number / 1000) == 1 ? "" : ToOrdinal(number / 1000, true))}tuhannes"); + parts.Add($"{(number / 1000 == 1 ? "" : ToOrdinal(number / 1000, true))}tuhannes"); number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { - parts.Add($"{((number / 100) == 1 ? "" : ToOrdinal(number / 100, true))}sadas"); + parts.Add($"{(number / 100 == 1 ? "" : ToOrdinal(number / 100, true))}sadas"); number %= 100; } - if (number >= 20 && (number / 10) > 0) + if (number >= 20 && number / 10 > 0) { parts.Add($"{ToOrdinal(number / 10, true)}kymmenes"); number %= 10; diff --git a/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs index 8972945c8..6fb32221e 100644 --- a/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs @@ -182,7 +182,7 @@ private string ConvertIntB13(long number, bool returnPluralized) => private string ConvertIntBH(long number, bool returnPluralized) { - var result = (number / 10 == 1) ? TensNoDiacriticsMap[number / 10] : TensMap[number / 10]; + var result = number / 10 == 1 ? TensNoDiacriticsMap[number / 10] : TensMap[number / 10]; if (number % 10 != 0) { diff --git a/src/Humanizer/Localisation/NumberToWords/IcelandicNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/IcelandicNumberToWordsConverter.cs index c5a7c2498..2b6f49d79 100644 --- a/src/Humanizer/Localisation/NumberToWords/IcelandicNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/IcelandicNumberToWordsConverter.cs @@ -30,7 +30,7 @@ private class Fact {18, new Fact{Power = 1000000000000000000 , Single = "ein trilljón", Plural = "trilljónir", OrdinalPrefix = "trilljónast", Gender = GrammaticalGender.Feminine }} }; private static bool IsAndSplitNeeded(int number) => - (((number <= 20) || (number % 10 == 0) && (number < 100)) || (number % 100 == 0)); + number <= 20 || number % 10 == 0 && number < 100 || number % 100 == 0; private static string GetOrdinalEnding(GrammaticalGender gender) => gender == GrammaticalGender.Masculine ? "i" : "a"; private static void GetUnits(ICollection builder, long number, GrammaticalGender gender) diff --git a/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs index f70940f0b..740ad657b 100644 --- a/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs @@ -40,9 +40,9 @@ public static string NumberToText( long number) if (number <= 99) return Tens[number / 10 - 2] + " " + NumberToText(number % 10); if (number <= 199) - return ("one hundred " + ((number % 100) > 0 ? "and " : "") + NumberToText(number % 100)).Trim(); + return ("one hundred " + (number % 100 > 0 ? "and " : "") + NumberToText(number % 100)).Trim(); if (number <= 999) - return NumberToText(number / 100) + "hundred " + ((number % 100) > 0 ? "and " : "") + NumberToText(number % 100); + return NumberToText(number / 100) + "hundred " + (number % 100 > 0 ? "and " : "") + NumberToText(number % 100); if (number <= 1999) return "one thousand " + NumberToText(number % 1000); if (number <= 99999) diff --git a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs index a0098d997..7027bbd76 100644 --- a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs +++ b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs @@ -145,7 +145,7 @@ protected static string ThreeDigitSetConverter(int number, bool thisIsLastSet = } // if this is the last set, an accent could be due - var unitsText = (thisIsLastSet && units == 3 ? "tré" : _unitsNumberToText[units]); + var unitsText = thisIsLastSet && units == 3 ? "tré" : _unitsNumberToText[units]; words += unitsText; } diff --git a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs index 35ad7e5b1..5342ed5e4 100644 --- a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs +++ b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs @@ -85,7 +85,7 @@ public string Convert() protected readonly int _fullNumber = number; protected readonly GrammaticalGender _gender = gender; - private readonly string _genderSuffix = (gender == GrammaticalGender.Feminine ? "a" : "o"); + private readonly string _genderSuffix = gender == GrammaticalGender.Feminine ? "a" : "o"; /// /// Lookup table converting units number to text. Index 1 for 1, index 2 for 2, up to index 9. diff --git a/src/Humanizer/Localisation/NumberToWords/LatvianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/LatvianNumberToWordsConverter.cs index 4f1f30f66..cf5a38cc6 100644 --- a/src/Humanizer/Localisation/NumberToWords/LatvianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/LatvianNumberToWordsConverter.cs @@ -17,7 +17,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd var parts = new List(); var number = (long)input; - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { var millionPart = ""; if (number == 1000000) @@ -32,7 +32,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd parts.Add(millionPart); } - if ((number / 1000) > 0) + if (number / 1000 > 0) { var thousandsPart = ""; if (number == 1000) @@ -51,7 +51,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { var hundredsPart = ""; if (number == 100) @@ -72,7 +72,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd if (number > 19) { - var tensPart = TensMap[(number / 10)]; + var tensPart = TensMap[number / 10]; parts.Add(tensPart); number %= 10; } @@ -102,7 +102,7 @@ public override string ConvertToOrdinal(int input, GrammaticalGender gender) var number = (long)input; - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { var millionPart = ""; if (number == 1000000) @@ -117,10 +117,10 @@ public override string ConvertToOrdinal(int input, GrammaticalGender gender) parts.Add(millionPart); } - if ((number / 1000) > 0) + if (number / 1000 > 0) { var thousandsPart = ""; - if ((number % 1000) == 0) + if (number % 1000 == 0) { if (number == 1000) { @@ -146,12 +146,12 @@ public override string ConvertToOrdinal(int input, GrammaticalGender gender) number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { var hundredsPart = ""; - if ((number % 100) == 0) + if (number % 100 == 0) { - hundredsPart = HundredsMap[(number / 100)] + GetOrdinalEndingForGender(gender); + hundredsPart = HundredsMap[number / 100] + GetOrdinalEndingForGender(gender); } else { @@ -170,8 +170,8 @@ public override string ConvertToOrdinal(int input, GrammaticalGender gender) if (number > 19) { - var tensPart = TensMap[(number / 10)]; - if ((number % 10) == 0) + var tensPart = TensMap[number / 10]; + if (number % 10 == 0) { tensPart += GetOrdinalEndingForGender(gender); } diff --git a/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs index 8342fce2b..97b6c6e98 100644 --- a/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs @@ -59,7 +59,7 @@ private string Convert(int number, bool isOrdinal, GrammaticalGender gender) var millionOrMore = false; const int billion = 1000000000; - if ((number / billion) > 0) + if (number / billion > 0) { millionOrMore = true; var isExactOrdinal = isOrdinal && number % billion == 0; @@ -68,7 +68,7 @@ private string Convert(int number, bool isOrdinal, GrammaticalGender gender) } const int million = 1000000; - if ((number / million) > 0) + if (number / million > 0) { millionOrMore = true; var isExactOrdinal = isOrdinal && number % million == 0; @@ -77,7 +77,7 @@ private string Convert(int number, bool isOrdinal, GrammaticalGender gender) } var thousand = false; - if ((number / 1000) > 0) + if (number / 1000 > 0) { thousand = true; parts.Add(Part("{0}tusen", number % 1000 < 100 ? "tusen" : "ettusen", number / 1000)); @@ -85,7 +85,7 @@ private string Convert(int number, bool isOrdinal, GrammaticalGender gender) } var hundred = false; - if ((number / 100) > 0) + if (number / 100 > 0) { hundred = true; parts.Add(Part("{0}hundre", thousand || millionOrMore ? "ethundre" : "hundre", number / 100)); @@ -113,7 +113,7 @@ private string Convert(int number, bool isOrdinal, GrammaticalGender gender) else { var lastPart = TensMap[number / 10]; - if ((number % 10) > 0) + if (number % 10 > 0) { lastPart += $"{GetUnitValue(number % 10, isOrdinal)}"; } diff --git a/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs index 9de8b9aa1..6865ddc6b 100644 --- a/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs @@ -98,7 +98,7 @@ private static void CollectParts(ICollection parts, long input, Grammati private static void CollectPartsUnderThousand(ICollection parts, int number, GrammaticalGender gender) { var hundredsDigit = number / 100; - var tensDigit = (number % 100) / 10; + var tensDigit = number % 100 / 10; var unitsDigit = number % 10; if (hundredsDigit >= 1) @@ -148,7 +148,7 @@ private static string GetPowerOfThousandNameForm(int multiplier, int power) } var multiplierUnitsDigit = multiplier % 10; - var multiplierTensDigit = (multiplier % 100) / 10; + var multiplierTensDigit = multiplier % 100 / 10; if (multiplierTensDigit == 1 || multiplierUnitsDigit <= 1 || multiplierUnitsDigit >= 5) { return PowersOfThousandMap[power][genitiveIndex]; diff --git a/src/Humanizer/Localisation/NumberToWords/PortugueseNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/PortugueseNumberToWordsConverter.cs index 6df88f94a..0bbeac2ad 100644 --- a/src/Humanizer/Localisation/NumberToWords/PortugueseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/PortugueseNumberToWordsConverter.cs @@ -31,7 +31,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { // gender is not applied for billions parts.Add(number / 1000000000 == 1 @@ -41,7 +41,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { // gender is not applied for millions parts.Add(number / 1000000 >= 2 @@ -51,14 +51,14 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { // gender is not applied for thousands parts.Add(number / 1000 == 1 ? "mil" : $"{Convert(number / 1000, GrammaticalGender.Masculine)} mil"); number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { if (number == 100) { @@ -67,7 +67,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd else { // Gender is applied to hundreds starting from 200 - parts.Add(ApplyGender(PortugueseHundredsMap[(number / 100)], gender)); + parts.Add(ApplyGender(PortugueseHundredsMap[number / 100], gender)); } number %= 100; @@ -87,7 +87,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd else { var lastPart = PortugueseTensMap[number / 10]; - if ((number % 10) > 0) + if (number % 10 > 0) { lastPart += $" e {ApplyGender(PortugueseUnitsMap[number % 10], gender)}"; } @@ -109,7 +109,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) var parts = new List(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add(number / 1000000000 == 1 ? $"{ApplyOrdinalGender("milésimo", gender)} {ApplyOrdinalGender("milionésimo", gender)}" @@ -118,7 +118,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add(number / 1000000 == 1 ? ApplyOrdinalGender("milionésimo", gender) @@ -127,7 +127,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) number %= 1000000; } - if ((number / 1000) > 0) + if (number / 1000 > 0) { parts.Add(number / 1000 == 1 ? ApplyOrdinalGender("milésimo", gender) @@ -136,13 +136,13 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) number %= 1000; } - if ((number / 100) > 0) + if (number / 100 > 0) { parts.Add(ApplyOrdinalGender(PortugueseOrdinalHundredsMap[number / 100], gender)); number %= 100; } - if ((number / 10) > 0) + if (number / 10 > 0) { parts.Add(ApplyOrdinalGender(PortugueseOrdinalTensMap[number / 10], gender)); number %= 10; diff --git a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs index b1cc186d5..e8c46da5f 100644 --- a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs @@ -218,7 +218,7 @@ private string ThreeDigitSetConverter(int number, GrammaticalGender gender, bool words += HundredsToText(hundreds); // append text for tens, only those from twenty upward - words += ((tens >= 2) ? " " : string.Empty) + _tensOver20NumberToText[tens]; + words += (tens >= 2 ? " " : string.Empty) + _tensOver20NumberToText[tens]; if (tensAndUnits <= 9) { @@ -233,7 +233,7 @@ private string ThreeDigitSetConverter(int number, GrammaticalGender gender, bool else { // exception for zero - var unitsText = (units == 0 ? string.Empty : " " + (_joinGroups + " " + GetPartByGender(_units[units], gender))); + var unitsText = units == 0 ? string.Empty : " " + _joinGroups + " " + GetPartByGender(_units[units], gender); words += unitsText; } diff --git a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs index c0aa71ee1..fa999f417 100644 --- a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs @@ -51,16 +51,16 @@ public string Convert(int number, GrammaticalGender gender) // remove 'de' preposition words = words.Replace(" de ", " "); - if ((gender == GrammaticalGender.Feminine) && words.EndsWith("zeci")) + if (gender == GrammaticalGender.Feminine && words.EndsWith("zeci")) { words = words.Substring(0, words.Length - 4) + "zece"; } - else if ((gender == GrammaticalGender.Feminine) && words.Contains("zeci") && (words.Contains("milioane") || words.Contains("miliarde"))) + else if (gender == GrammaticalGender.Feminine && words.Contains("zeci") && (words.Contains("milioane") || words.Contains("miliarde"))) { words = words.Replace("zeci", "zecea"); } - if ((gender == GrammaticalGender.Feminine) && words.StartsWith("un ")) + if (gender == GrammaticalGender.Feminine && words.StartsWith("un ")) { words = words.Substring(2).TrimStart(); } @@ -94,11 +94,11 @@ public string Convert(int number, GrammaticalGender gender) } // trim last letter - if ((gender == GrammaticalGender.Feminine) && (!words.EndsWith("zece") && - (words.EndsWith("a") || - words.EndsWith("ă") || - words.EndsWith("e") || - words.EndsWith("i")))) + if (gender == GrammaticalGender.Feminine && !words.EndsWith("zece") && + (words.EndsWith("a") || + words.EndsWith("ă") || + words.EndsWith("e") || + words.EndsWith("i"))) { words = words.Substring(0, words.Length - 1); } diff --git a/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs index 61bc0ac3e..265e7bbd1 100644 --- a/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs @@ -123,7 +123,7 @@ private static string ConvertHundreds(in long inputNumber, out long remainder, G var wordPart = string.Empty; remainder = inputNumber; - if ((inputNumber / 100) > 0) + if (inputNumber / 100 > 0) { wordPart = inputNumber == 100 ? "cien" : @@ -148,7 +148,7 @@ private static string ConvertMappedOrdinalNumber( var wordPart = string.Empty; remainder = number; - if ((number / divisor) > 0) + if (number / divisor > 0) { var genderedEnding = gender == GrammaticalGender.Feminine ? "a" : "o"; wordPart = map[number / divisor] + genderedEnding; @@ -285,7 +285,7 @@ private string ConvertGreaterThanMillion(in long inputNumber, out long remainder foreach (var numberAndWord in numbersAndWordsDict) { - if ((remainder / numberAndWord.Value) > 0) + if (remainder / numberAndWord.Value > 0) { if (remainder / numberAndWord.Value == 1) { @@ -293,7 +293,7 @@ private string ConvertGreaterThanMillion(in long inputNumber, out long remainder } else { - wordBuilder.Add((remainder / numberAndWord.Value % 10 == 1) ? + wordBuilder.Add(remainder / numberAndWord.Value % 10 == 1 ? $"{Convert(remainder / numberAndWord.Value, WordForm.Abbreviation, GrammaticalGender.Masculine)} {PluralizeGreaterThanMillion(numberAndWord.Key)}" : $"{Convert(remainder / numberAndWord.Value)} {PluralizeGreaterThanMillion(numberAndWord.Key)}"); } @@ -318,9 +318,9 @@ private string ConvertTensAndHunderdsOfThousandths(in int number, out int remain var wordPart = string.Empty; remainder = number; - if ((number / 10000) > 0) + if (number / 10000 > 0) { - wordPart = Convert((number / 1000) * 1000, gender); + wordPart = Convert(number / 1000 * 1000, gender); if (number < 30000 || IsRoundNumber(number)) { @@ -355,7 +355,7 @@ private string ConvertThousands(in long inputNumber, out long remainder, Grammat var wordPart = string.Empty; remainder = inputNumber; - if ((inputNumber / 1000) > 0) + if (inputNumber / 1000 > 0) { if (inputNumber / 1000 == 1) { @@ -363,7 +363,7 @@ private string ConvertThousands(in long inputNumber, out long remainder, Grammat } else { - wordPart = (gender == GrammaticalGender.Feminine) ? + wordPart = gender == GrammaticalGender.Feminine ? $"{Convert(inputNumber / 1000, GrammaticalGender.Feminine)} mil" : $"{Convert(inputNumber / 1000, WordForm.Abbreviation, gender)} mil"; } diff --git a/src/Humanizer/Localisation/NumberToWords/SwedishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SwedishNumberToWordsConverter.cs index d728dd903..e6c98801c 100644 --- a/src/Humanizer/Localisation/NumberToWords/SwedishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SwedishNumberToWordsConverter.cs @@ -188,7 +188,7 @@ public override string ConvertToOrdinal(int number) } // suffix -de/-te - if (divided > 0 && (number % m.Value) == 0) + if (divided > 0 && number % m.Value == 0) { switch (number) { diff --git a/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs index bbe121ae7..fdf83161d 100644 --- a/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs @@ -37,13 +37,13 @@ private string ConvertImpl(long number, bool isOrdinal) var parts = new List(); - if ((number / 1000000000000000000) > 0) + if (number / 1000000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000000)} quintillion"); number %= 1000000000000000000; } - if ((number / 1000000000000000) > 0) + if (number / 1000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000)} quadrillion"); number %= 1000000000000000; @@ -67,13 +67,13 @@ private string ConvertImpl(long number, bool isOrdinal) // number %= 1000000; //} - if ((number / 10000000) > 0) parts.Add(GetCroresValue(ref number)); + if (number / 10000000 > 0) parts.Add(GetCroresValue(ref number)); - if ((number / 100000) > 0) parts.Add(GetLakhsValue(ref number, isOrdinal)); + if (number / 100000 > 0) parts.Add(GetLakhsValue(ref number, isOrdinal)); - if ((number / 1000) > 0) parts.Add(GetThousandsValue(ref number)); + if (number / 1000 > 0) parts.Add(GetThousandsValue(ref number)); - if ((number / 100) > 0) parts.Add(GetHundredsValue(ref number)); + if (number / 100 > 0) parts.Add(GetHundredsValue(ref number)); if (number > 0) parts.Add(GetTensValue(number, isOrdinal)); @@ -106,11 +106,11 @@ private static string GetTensValue(long number, bool isOrdinal, bool isThousand var local_word = ""; if (number < 20) local_word = GetUnitValue(number, isOrdinal); - else if ((number >= 20) && (number <= 99)) + else if (number >= 20 && number <= 99) { var lastPart = TensMap[number / 10]; var quot = number / 10; - if ((number % 10) > 0) + if (number % 10 > 0) { if (quot == 9) lastPart += "ற்றி "; @@ -156,7 +156,7 @@ private static string GetLakhsValue(ref long number, bool isOrdinal) } else if (num_above_10 == 1) local_word = "ஒரு " + LakhsMap[0]; - else local_word += GetTensValue((number / 100000), isOrdinal) + " " + LakhsMap[0]; + else local_word += GetTensValue(number / 100000, isOrdinal) + " " + LakhsMap[0]; if (number % 1000000 == 0 || number % 100000 == 0) local_word += "ம்"; @@ -219,11 +219,11 @@ private static string GetThousandsValue(ref long number) if (num_above_10 % 10 == 1) local_word += "ஓரா"; else if (num_above_10 % 10 > 1) - local_word += ThousandsMap[(num_above_10 % 10) - 1]; + local_word += ThousandsMap[num_above_10 % 10 - 1]; } else - local_word += ThousandsMap[(number / 1000) - 1]; + local_word += ThousandsMap[number / 1000 - 1]; number %= 1000; @@ -238,7 +238,7 @@ private static string GetHundredsValue(ref long number) { var local_word = ""; { - local_word = HundredsMap[(number / 100) - 1]; + local_word = HundredsMap[number / 100 - 1]; if (number / 100 == 9) { if (number % 100 == 0) diff --git a/src/Humanizer/Localisation/NumberToWords/ThaiNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ThaiNumberToWordsConverter.cs index cd0fb4750..59d7d6046 100644 --- a/src/Humanizer/Localisation/NumberToWords/ThaiNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ThaiNumberToWordsConverter.cs @@ -13,31 +13,31 @@ public override string Convert(long numbermoney) if (numbermoney < 0) { Textreturn = "ลบ"; - numbermoney = -(numbermoney); + numbermoney = -numbermoney; } - if ((numbermoney / 1000000) > 0) + if (numbermoney / 1000000 > 0) { Textreturn += Convert(numbermoney / 1000000) + "ล้าน"; numbermoney %= 1000000; } - if ((numbermoney / 100000) > 0) + if (numbermoney / 100000 > 0) { Textreturn += Convert(numbermoney / 100000) + "แสน"; numbermoney %= 100000; } - if ((numbermoney / 10000) > 0) + if (numbermoney / 10000 > 0) { Textreturn += Convert(numbermoney / 10000) + "หมื่น"; numbermoney %= 10000; } - if ((numbermoney / 1000) > 0) + if (numbermoney / 1000 > 0) { Textreturn += Convert(numbermoney / 1000) + "พัน"; numbermoney %= 1000; } - if ((numbermoney / 100) > 0) + if (numbermoney / 100 > 0) { Textreturn += Convert(numbermoney / 100) + "ร้อย"; numbermoney %= 100; @@ -60,7 +60,7 @@ public override string Convert(long numbermoney) else { Textreturn += tensMap[numbermoney / 10]; - if ((numbermoney % 10) > 0) + if (numbermoney % 10 > 0) { Textreturn += "" + unitsMap[numbermoney % 10]; } diff --git a/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs index f9b6565e6..234d7f9f9 100644 --- a/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs @@ -44,51 +44,51 @@ public override string Convert(long input) var parts = new List(); - if ((number / 1000000000000000000) > 0) + if (number / 1000000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000000)} kentilyon"); number %= 1000000000000000000; } - if ((number / 1000000000000000) > 0) + if (number / 1000000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000000)} katrilyon"); number %= 1000000000000000; } - if ((number / 1000000000000) > 0) + if (number / 1000000000000 > 0) { parts.Add($"{Convert(number / 1000000000000)} trilyon"); number %= 1000000000000; } - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { parts.Add($"{Convert(number / 1000000000)} milyar"); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { parts.Add($"{Convert(number / 1000000)} milyon"); number %= 1000000; } - var thousand = (number / 1000); + var thousand = number / 1000; if (thousand > 0) { parts.Add($"{(thousand > 1 ? Convert(thousand) : "")} bin".Trim()); number %= 1000; } - var hundred = (number / 100); + var hundred = number / 100; if (hundred > 0) { parts.Add($"{(hundred > 1 ? Convert(hundred) : "")} yüz".Trim()); number %= 100; } - if ((number / 10) > 0) + if (number / 10 > 0) { parts.Add(TensMap[number / 10]); number %= 10; diff --git a/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs index aca465891..ba3a06ca2 100644 --- a/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs @@ -36,33 +36,33 @@ private static string Convert(int number, bool checkForHundredRule) var sb = new StringBuilder(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { sb.AppendFormat("{0} миллиард ", Convert(number / 1000000000, false)); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { sb.AppendFormat("{0} миллион ", Convert(number / 1000000, true)); number %= 1000000; } - var thousand = (number / 1000); + var thousand = number / 1000; if (thousand > 0) { sb.AppendFormat("{0} минг ", Convert(thousand, true)); number %= 1000; } - var hundred = (number / 100); + var hundred = number / 100; if (hundred > 0) { sb.AppendFormat("{0} юз ", Convert(hundred, false)); number %= 100; } - if ((number / 10) > 0) + if (number / 10 > 0) { sb.AppendFormat("{0} ", TensMap[number / 10]); number %= 10; diff --git a/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs index 1aeddd37c..fbe47a0be 100644 --- a/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs @@ -36,33 +36,33 @@ private static string Convert(int number, bool checkForHundredRule) var sb = new StringBuilder(); - if ((number / 1000000000) > 0) + if (number / 1000000000 > 0) { sb.AppendFormat("{0} milliard ", Convert(number / 1000000000, false)); number %= 1000000000; } - if ((number / 1000000) > 0) + if (number / 1000000 > 0) { sb.AppendFormat("{0} million ", Convert(number / 1000000, true)); number %= 1000000; } - var thousand = (number / 1000); + var thousand = number / 1000; if (thousand > 0) { sb.AppendFormat("{0} ming ", Convert(thousand, true)); number %= 1000; } - var hundred = (number / 100); + var hundred = number / 100; if (hundred > 0) { sb.AppendFormat("{0} yuz ", Convert(hundred, false)); number %= 100; } - if ((number / 10) > 0) + if (number / 10 > 0) { sb.AppendFormat("{0} ", TensMap[number / 10]); number %= 10; diff --git a/src/Humanizer/Localisation/TimeToClockNotation/EsTimeOnlyToClockNotationConverter.cs b/src/Humanizer/Localisation/TimeToClockNotation/EsTimeOnlyToClockNotationConverter.cs index 2b3f43bbf..f043e06bd 100644 --- a/src/Humanizer/Localisation/TimeToClockNotation/EsTimeOnlyToClockNotationConverter.cs +++ b/src/Humanizer/Localisation/TimeToClockNotation/EsTimeOnlyToClockNotationConverter.cs @@ -49,7 +49,7 @@ public string Convert(TimeOnly time, ClockNotationRounding roundToNearestFive) } private static int NormalizeHour(TimeOnly time) => - time.Hour % 12 != 0 ? (time.Hour % 12) : 12; + time.Hour % 12 != 0 ? time.Hour % 12 : 12; private static string GetArticle(TimeOnly time) => time.Hour is 1 or 13 ? "la" : "las"; diff --git a/src/Humanizer/RomanNumeralExtensions.cs b/src/Humanizer/RomanNumeralExtensions.cs index 265cc7809..4faeda6a6 100644 --- a/src/Humanizer/RomanNumeralExtensions.cs +++ b/src/Humanizer/RomanNumeralExtensions.cs @@ -48,7 +48,7 @@ public static int FromRoman(this string input) var length = input.Length; - if ((length == 0) || IsInvalidRomanNumeral(input)) + if (length == 0 || IsInvalidRomanNumeral(input)) { throw new ArgumentException("Empty or invalid Roman numeral string.", nameof(input)); } diff --git a/src/Humanizer/TimeSpanHumanizeExtensions.cs b/src/Humanizer/TimeSpanHumanizeExtensions.cs index 5558ee348..b5a618d92 100644 --- a/src/Humanizer/TimeSpanHumanizeExtensions.cs +++ b/src/Humanizer/TimeSpanHumanizeExtensions.cs @@ -81,7 +81,7 @@ private static string GetTimeUnitPart(TimeUnit timeUnitToGet, TimeSpan timespan, private static int GetTimeUnitNumericalValue(TimeUnit timeUnitToGet, TimeSpan timespan, TimeUnit maximumTimeUnit) { - var isTimeUnitToGetTheMaximumTimeUnit = (timeUnitToGet == maximumTimeUnit); + var isTimeUnitToGetTheMaximumTimeUnit = timeUnitToGet == maximumTimeUnit; switch (timeUnitToGet) { case TimeUnit.Millisecond: @@ -171,7 +171,7 @@ private static List CreateTimePartsWithNoTimeValue(string noTimeValue) = new() { noTimeValue }; private static bool IsContainingOnlyNullValue(IEnumerable timeParts) => - (timeParts.Count(x => x != null) == 0); + timeParts.Count(x => x != null) == 0; private static IEnumerable SetPrecisionOfTimeSpan(IEnumerable timeParts, int precision, bool countEmptyUnits) {