diff --git a/src/Humanizer/Localisation/Formatters/RussianFormatter.cs b/src/Humanizer/Localisation/Formatters/RussianFormatter.cs index 4387ce457..e6ea06fe3 100644 --- a/src/Humanizer/Localisation/Formatters/RussianFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/RussianFormatter.cs @@ -10,7 +10,7 @@ protected override string GetResourceKey(string resourceKey, int number) return resourceKey + suffix; } - private string GetSuffix(RussianGrammaticalNumber grammaticalNumber) + private static string GetSuffix(RussianGrammaticalNumber grammaticalNumber) { if (grammaticalNumber == RussianGrammaticalNumber.Singular) { diff --git a/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs b/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs index d426ff81b..43e37beeb 100644 --- a/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs @@ -9,7 +9,7 @@ protected override string GetResourceKey(string resourceKey, int number) return resourceKey + suffix; } - private string GetSuffix(RussianGrammaticalNumber grammaticalNumber) + private static string GetSuffix(RussianGrammaticalNumber grammaticalNumber) { if (grammaticalNumber == RussianGrammaticalNumber.Singular) { diff --git a/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs index 91672cdc0..76f7aceaf 100644 --- a/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BulgarianNumberToWordsConverter.cs @@ -37,7 +37,7 @@ internal class BulgarianNumberToWordsConverter : GenderedNumberToWordsConverter public override string Convert(long input, GrammaticalGender gender, bool addAnd = true) => Convert(input, gender, false); - private string Convert(long input, GrammaticalGender gender, bool isOrdinal, bool addAnd = true) + private static string Convert(long input, GrammaticalGender gender, bool isOrdinal, bool addAnd = true) { if (input is > int.MaxValue or < int.MinValue) { diff --git a/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs index fbbfe9e20..df4adb350 100644 --- a/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/CentralKurdishNumberToWordsConverter.cs @@ -68,7 +68,7 @@ public override string ConvertToOrdinal(int number) return $"{word}{(IsVowel(word[word.Length - 1]) ? "یەم" : "ەم")}"; } - private bool IsVowel(char c) => + private static bool IsVowel(char c) => c is 'ا' or 'ێ' or 'ۆ' or 'ە' or 'ی'; } } diff --git a/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs index d445dd4b0..63bab29cc 100644 --- a/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs @@ -10,9 +10,9 @@ public override string Convert(long number) => public override string ConvertToOrdinal(int number) => Convert(number, true, IsSpecial(number)); - private bool IsSpecial(long number) => number > 10 && number < 20; + private static bool IsSpecial(long number) => number > 10 && number < 20; - private string Convert(long number, bool isOrdinal, bool isSpecial) + private static string Convert(long number, bool isOrdinal, bool isSpecial) { if (number == 0) { diff --git a/src/Humanizer/Localisation/NumberToWords/CzechNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/CzechNumberToWordsConverter.cs index 4c5b83e13..b0d464f0b 100644 --- a/src/Humanizer/Localisation/NumberToWords/CzechNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/CzechNumberToWordsConverter.cs @@ -45,7 +45,7 @@ public override string Convert(long number, GrammaticalGender gender, bool addAn public override string ConvertToOrdinal(int number, GrammaticalGender gender) => number.ToString(_culture); - private string UnitByGender(long number, GrammaticalGender? gender) + private static string UnitByGender(long number, GrammaticalGender? gender) { if (number != 1 && number != 2) { @@ -62,7 +62,7 @@ private string UnitByGender(long number, GrammaticalGender? gender) }; } - private void CollectLessThanThousand(List parts, long number, GrammaticalGender? gender) + private static void CollectLessThanThousand(List parts, long number, GrammaticalGender? gender) { if (number >= 100) { diff --git a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs index 396bef2cc..c85e1e218 100644 --- a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs @@ -85,7 +85,7 @@ public override string Convert(long input) return string.Join("", parts).Trim(); } - private string GetOrdinalUnit(int number, bool useExceptions) + private static string GetOrdinalUnit(int number, bool useExceptions) { if (useExceptions && OrdinalExceptions.ContainsKey(number)) { @@ -95,7 +95,7 @@ private string GetOrdinalUnit(int number, bool useExceptions) return OrdinalUnitsMap[number]; } - private string ToOrdinal(int number, bool useExceptions) + private static string ToOrdinal(int number, bool useExceptions) { if (number == 0) { diff --git a/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs b/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs index 925d20fe8..637aca997 100644 --- a/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs +++ b/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs @@ -131,10 +131,10 @@ private string Part(string pluralFormat, string singular, long number) return string.Format(pluralFormat, Convert(number)); } - private int NoRestIndex(int number) => + private static int NoRestIndex(int number) => number == 0 ? 0 : 1; - private string GetEndingForGender(GrammaticalGender gender) + private static string GetEndingForGender(GrammaticalGender gender) { switch (gender) { diff --git a/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs index 42d8ea5f7..8972945c8 100644 --- a/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/GreekNumberToWordsConverter.cs @@ -76,14 +76,17 @@ public override string ConvertToOrdinal(int number) return string.Empty; } - private string GetOneDigitOrdinal(int number) + private static string GetOneDigitOrdinal(int number) { - if (!ΟrdinalMap.TryGetValue(number, out var output)) return string.Empty; + if (ΟrdinalMap.TryGetValue(number, out var output)) + { + return output; + } - return output; + return string.Empty; } - private string GetTwoDigitOrdinal(int number) + private static string GetTwoDigitOrdinal(int number) { if (number == 11) return "ενδέκατος"; if (number == 12) return "δωδέκατος"; @@ -100,26 +103,26 @@ private string GetTwoDigitOrdinal(int number) return decadesString; } - private string GetThreeDigitOrdinal(int number) + private static string GetThreeDigitOrdinal(int number) { - var hundrends = number / 100; + var hundreds = number / 100; - if (!ΟrdinalMap.TryGetValue(hundrends*100, out var hundrentsString)) return string.Empty; + if (!ΟrdinalMap.TryGetValue(hundreds*100, out var hundredsString)) return string.Empty; - if (number - hundrends*100> 10) + if (number - hundreds*100> 10) { - return hundrentsString + " " + GetTwoDigitOrdinal(number - hundrends*100); + return hundredsString + " " + GetTwoDigitOrdinal(number - hundreds*100); } - if(number - hundrends * 100 > 0) + if(number - hundreds * 100 > 0) { - return hundrentsString + " " + GetOneDigitOrdinal(number - hundrends*100); + return hundredsString + " " + GetOneDigitOrdinal(number - hundreds*100); } - return hundrentsString; + return hundredsString; } - private string GetFourDigitOrdinal(int number) + private static string GetFourDigitOrdinal(int number) { var thousands = number / 1000; diff --git a/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs index 04b4845ee..f70940f0b 100644 --- a/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/IndianNumberToWordsConverter.cs @@ -29,7 +29,7 @@ public override string ConvertToOrdinal(int number) return result; } - public string NumberToText( long number) + public static string NumberToText( long number) { if (number < 0) return "(Negative) " + NumberToText(-number); diff --git a/src/Humanizer/Localisation/NumberToWords/JapaneseNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/JapaneseNumberToWordsConverter.cs index 4fde91bda..1f5f91f5d 100644 --- a/src/Humanizer/Localisation/NumberToWords/JapaneseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/JapaneseNumberToWordsConverter.cs @@ -13,7 +13,7 @@ public override string Convert(long number) => public override string ConvertToOrdinal(int number) => ConvertImpl(number, true); - private string ConvertImpl(long number, bool isOrdinal) + private static string ConvertImpl(long number, bool isOrdinal) { if (number == 0) { diff --git a/src/Humanizer/Localisation/NumberToWords/KoreanNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/KoreanNumberToWordsConverter.cs index ef9faffa6..60ed278e4 100644 --- a/src/Humanizer/Localisation/NumberToWords/KoreanNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/KoreanNumberToWordsConverter.cs @@ -36,7 +36,7 @@ public override string Convert(long number) => public override string ConvertToOrdinal(int number) => ConvertImpl(number, true); - private string ConvertImpl(long number, bool isOrdinal) + private static string ConvertImpl(long number, bool isOrdinal) { if (isOrdinal && number < 20) { diff --git a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs index 10f8c100b..b1cc186d5 100644 --- a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs @@ -134,7 +134,7 @@ public string Convert(int number, GrammaticalGender gender) /// /// The number to split. /// The sequence of three-digit numbers. - private List SplitEveryThreeDigits(int number) + private static List SplitEveryThreeDigits(int number) { var parts = new List(); var rest = number; @@ -223,17 +223,17 @@ private string ThreeDigitSetConverter(int number, GrammaticalGender gender, bool if (tensAndUnits <= 9) { // simple case for units, under 10 - words += " " + getPartByGender(_units[tensAndUnits], gender); + words += " " + GetPartByGender(_units[tensAndUnits], gender); } else if (tensAndUnits <= 19) { // special case for 'teens', from 10 to 19 - words += " " + getPartByGender(_teensUnder20NumberToText[tensAndUnits - 10], gender); + words += " " + GetPartByGender(_teensUnder20NumberToText[tensAndUnits - 10], gender); } 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; } @@ -241,7 +241,7 @@ private string ThreeDigitSetConverter(int number, GrammaticalGender gender, bool return words; } - private string getPartByGender(string multiGenderPart, GrammaticalGender gender) + private static string GetPartByGender(string multiGenderPart, GrammaticalGender gender) { if (multiGenderPart.Contains("|")) { @@ -266,8 +266,8 @@ private string getPartByGender(string multiGenderPart, GrammaticalGender gender) } } - private bool IsAbove20(int number) => - (number >= 20); + private static bool IsAbove20(int number) => + number >= 20; private string HundredsToText(int hundreds) { @@ -281,7 +281,7 @@ private string HundredsToText(int hundreds) } else { - return getPartByGender(_units[hundreds], GrammaticalGender.Feminine) + " sute"; + return GetPartByGender(_units[hundreds], GrammaticalGender.Feminine) + " sute"; } } diff --git a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs index 5b18eaf19..c0aa71ee1 100644 --- a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs @@ -33,14 +33,14 @@ public string Convert(int number, GrammaticalGender gender) else if (number == 1) { // no prefixes for primul/prima - return this.getPartByGender(_ordinalsUnder10[number], gender); + return GetPartByGender(_ordinalsUnder10[number], gender); } else if (number <= 9) { // units ordinals, 2 to 9, are totally different than the rest: treat them as a distinct case return string.Format("{0} {1}", gender == GrammaticalGender.Feminine ? _femininePrefix : _masculinePrefix, - this.getPartByGender(_ordinalsUnder10[number], gender) + GetPartByGender(_ordinalsUnder10[number], gender) ); } else @@ -111,7 +111,7 @@ public string Convert(int number, GrammaticalGender gender) } } - private string getPartByGender(string multiGenderPart, GrammaticalGender gender) + private static string GetPartByGender(string multiGenderPart, GrammaticalGender gender) { if (multiGenderPart.Contains("|")) { diff --git a/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs index 087423f69..aca465891 100644 --- a/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs @@ -22,14 +22,14 @@ public override string Convert(long input) return Convert(number, true); } - private string Convert(int number, bool checkForHoundredRule) + private static string Convert(int number, bool checkForHundredRule) { if (number == 0) { return UnitsMap[0]; } - if (checkForHoundredRule && number == 100) + if (checkForHundredRule && number == 100) { return "юз"; } diff --git a/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs index 694a56828..1aeddd37c 100644 --- a/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs @@ -22,14 +22,14 @@ public override string Convert(long input) return Convert(number, true); } - private string Convert(int number, bool checkForHoundredRule) + private static string Convert(int number, bool checkForHundredRule) { if (number == 0) { return UnitsMap[0]; } - if (checkForHoundredRule && number == 100) + if (checkForHundredRule && number == 100) { return "yuz"; }