From af7974ebf88c34b45547f46bec3bb3ea73e9bc45 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Fri, 16 Feb 2024 22:11:04 +1100 Subject: [PATCH] remove redundant parens (#1363) --- .../BitFieldEnumHumanizeTests.cs | 4 +-- .../MetricNumeralTests.cs | 2 +- .../DateTimeHumanizeAlgorithms.cs | 4 +-- src/Humanizer/FluentDate/In.SomeTimeFrom.tt | 2 +- .../FluentDate/InDate.SomeTimeFrom.tt | 2 +- src/Humanizer/HeadingExtensions.cs | 6 ++-- .../AfrikaansNumberToWordsConverter.cs | 14 +++++----- .../ArabicNumberToWordsConverter.cs | 2 +- .../ArmenianNumberToWordsConverter.cs | 20 ++++++------- .../AzerbaijaniNumberToWordsConverter.cs | 10 +++---- .../BanglaNumberToWordsConverter.cs | 8 +++--- ...azilianPortugueseNumberToWordsConverter.cs | 22 +++++++-------- .../BulgarianNumberToWordsConverter.cs | 8 +++--- .../CentralKurdishNumberToWordsConverter.cs | 2 +- .../ChineseNumberToWordsConverter.cs | 12 ++++---- .../DutchNumberToWordsConverter.cs | 2 +- .../EnglishNumberToWordsConverter.cs | 16 +++++------ .../FarsiNumberToWordsConverter.cs | 2 +- .../FinnishNumberToWordsConverter.cs | 28 +++++++++---------- .../GreekNumberToWordsConverter.cs | 2 +- .../IcelandicNumberToWordsConverter.cs | 2 +- .../IndianNumberToWordsConverter.cs | 4 +-- .../Italian/ItalianCardinalNumberCruncher.cs | 2 +- .../Italian/ItalianOrdinalNumberCruncher.cs | 2 +- .../LatvianNumberToWordsConverter.cs | 24 ++++++++-------- .../NorwegianBokmalNumberToWordsConverter.cs | 10 +++---- .../PolishNumberToWordsConverter.cs | 4 +-- .../PortugueseNumberToWordsConverter.cs | 22 +++++++-------- .../RomanianCardinalNumberConverter.cs | 4 +-- .../RomanianOrdinalNumberConverter.cs | 16 +++++------ .../SpanishNumberToWordsConverter.cs | 16 +++++------ .../SwedishNumberToWordsConverter.cs | 2 +- .../TamilNumberToWordsConverter.cs | 24 ++++++++-------- .../ThaiNumberToWordsConverter.cs | 14 +++++----- .../TurkishNumberToWordConverter.cs | 16 +++++------ .../UzbekCyrlNumberToWordConverter.cs | 10 +++---- .../UzbekLatnNumberToWordConverter.cs | 10 +++---- .../EsTimeOnlyToClockNotationConverter.cs | 2 +- src/Humanizer/RomanNumeralExtensions.cs | 2 +- src/Humanizer/TimeSpanHumanizeExtensions.cs | 2 +- 40 files changed, 178 insertions(+), 178 deletions(-) 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 5e9bdd02b..623a9d1dd 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]; @@ -57,7 +57,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]; } @@ -110,7 +110,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 52efb83d3..433ff09b0 100644 --- a/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs @@ -46,25 +46,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; @@ -86,13 +86,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 045d641de..69c125b53 100644 --- a/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs @@ -85,7 +85,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 089adc202..8ffa65d41 100644 --- a/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs @@ -53,40 +53,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("հազար"); } @@ -98,9 +98,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("հարյուր"); } @@ -121,7 +121,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 ad1632cb7..c87ba1978 100644 --- a/src/Humanizer/Localisation/NumberToWords/AzerbaijaniNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/AzerbaijaniNumberToWordsConverter.cs @@ -38,33 +38,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 51779860d..8015ea422 100644 --- a/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs @@ -78,25 +78,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 e755f9e78..6438a39f3 100644 --- a/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs @@ -32,7 +32,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 @@ -42,7 +42,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 @@ -52,14 +52,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) { @@ -68,7 +68,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; @@ -88,7 +88,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)}"; } @@ -110,7 +110,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) @@ -119,7 +119,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) @@ -128,7 +128,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) @@ -137,13 +137,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 de0524e79..664555ee1 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 4e76b02b8..7858076b3 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 7755153b2..5b4bb0c36 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 b6faa0f29..2cb03d509 100644 --- a/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs @@ -121,7 +121,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 146d3ed88..c79e8f490 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 35f9ce57a..294757ee2 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 e89602574..7b0a153e7 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 60f3f83c4..aba36e3cc 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 8637d774e..3694096bb 100644 --- a/src/Humanizer/Localisation/NumberToWords/IcelandicNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/IcelandicNumberToWordsConverter.cs @@ -30,7 +30,7 @@ private class Fact {18, new(){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 f15a1854a..af3f13460 100644 --- a/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs @@ -46,9 +46,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 796f345e2..36e714d45 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 cb3d1dbfe..3439201ec 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 c9ad9f42e..645114576 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 345e3e162..50da9f8b4 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 8b0d43433..07d09ed6c 100644 --- a/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs @@ -94,7 +94,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) @@ -144,7 +144,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 ec14d173b..c5e4f3044 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 14cb3c604..62cdb7744 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 30e87e763..7b2f0590b 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 c5cc408dc..674010cdc 100644 --- a/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs @@ -140,7 +140,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" : @@ -165,7 +165,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; @@ -302,7 +302,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) { @@ -310,7 +310,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)}"); } @@ -335,9 +335,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)) { @@ -372,7 +372,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) { @@ -380,7 +380,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 c4fb8bd12..c7da4fa81 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 94dedaef4..5489321e8 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 f5d9c463f..8b2b768ea 100644 --- a/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs @@ -45,51 +45,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 87e560cbe..1d19a43dd 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 e2d5f1fd7..c7cbef30c 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 5d176be74..edd5c4c82 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 324551bc9..c93fb847b 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: