From 7211812386d4ba15f6f1899fd173ced8a031176c Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 17 Feb 2024 21:48:29 +1100 Subject: [PATCH] replace string.Join+empty with sting.concat --- .../NumberToWords/CroatianNumberToWordsConverter.cs | 2 +- .../NumberToWords/FinnishNumberToWordsConverter.cs | 4 ++-- .../NumberToWords/GermanNumberToWordsConverterBase.cs | 4 ++-- .../NumberToWords/LuxembourgishNumberToWordsConverter.cs | 6 +++--- .../NumberToWords/RussianNumberToWordsConverter.cs | 2 +- .../NumberToWords/SerbianCyrlNumberToWordsConverter.cs | 2 +- .../NumberToWords/SerbianNumberToWordsConverter.cs | 2 +- .../NumberToWords/SlovenianNumberToWordsConverter.cs | 2 +- .../NumberToWords/UkrainianNumberToWordsConverter.cs | 2 +- src/Humanizer/StringDehumanizeExtensions.cs | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Humanizer/Localisation/NumberToWords/CroatianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/CroatianNumberToWordsConverter.cs index ba21ef21e..1b6adf43f 100644 --- a/src/Humanizer/Localisation/NumberToWords/CroatianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/CroatianNumberToWordsConverter.cs @@ -94,7 +94,7 @@ public override string Convert(long input) } } - return string.Join("", parts); + return string.Concat(parts); } public override string ConvertToOrdinal(int number) => diff --git a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs index f60ae766e..b183b1392 100644 --- a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs @@ -82,7 +82,7 @@ public override string Convert(long input) parts.Add(UnitsMap[number]); } - return string.Join("", parts).Trim(); + return string.Concat( parts).Trim(); } static string GetOrdinalUnit(int number, bool useExceptions) @@ -143,7 +143,7 @@ static string ToOrdinal(int number, bool useExceptions) parts.Add(GetOrdinalUnit(number, useExceptions)); } - return string.Join("", parts); + return string.Concat(parts); } public override string ConvertToOrdinal(int number) => diff --git a/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs b/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs index 0a71b9a99..92a4b4b06 100644 --- a/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs +++ b/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs @@ -61,7 +61,7 @@ public override string Convert(long number, GrammaticalGender gender, bool addAn } } - return string.Join("", parts); + return string.Concat(parts); } public override string ConvertToOrdinal(int number, GrammaticalGender gender) @@ -95,7 +95,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) parts.Add(GetEndingForGender(gender)); - return string.Join("", parts); + return string.Concat(parts); } void CollectParts(ICollection parts, ref long number, long divisor, bool addSpaceBeforeNextPart, string pluralFormat, string singular) diff --git a/src/Humanizer/Localisation/NumberToWords/LuxembourgishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/LuxembourgishNumberToWordsConverter.cs index 702333537..b929f8103 100644 --- a/src/Humanizer/Localisation/NumberToWords/LuxembourgishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/LuxembourgishNumberToWordsConverter.cs @@ -41,7 +41,7 @@ public override string Convert(long number, WordForm wordForm, GrammaticalGender if (number <= 0) { - return string.Join("", parts); + return string.Concat(parts); } if (number < 20) @@ -78,7 +78,7 @@ public override string Convert(long number, WordForm wordForm, GrammaticalGender parts.Add(tens); } - return string.Join("", parts); + return string.Concat(parts); } public override string ConvertToOrdinal(int number, GrammaticalGender gender) @@ -112,7 +112,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) parts.Add(GetEndingForGender(gender)); - return string.Join("", parts); + return string.Concat(parts); } private void CollectParts(ICollection parts, ref long number, long divisor, bool addSpaceBeforeNextPart, string pluralFormat, string singular) diff --git a/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs index 7a846d420..a9cbd1107 100644 --- a/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs @@ -164,7 +164,7 @@ static string GetPrefix(long number) parts.Add(number == 1 ? "одно" : UnitsOrdinalPrefixes[number]); } - return string.Join("", parts); + return string.Concat(parts); } static void CollectParts(ICollection parts, ref long number, long divisor, GrammaticalGender gender, params string[] forms) diff --git a/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs index ce2524ba8..196cada14 100644 --- a/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs @@ -96,7 +96,7 @@ public override string Convert(long input) } } - return string.Join("", parts); + return string.Concat(parts); } public override string ConvertToOrdinal(int number) => diff --git a/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs index 9298b3710..71cf0be3f 100644 --- a/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs @@ -94,7 +94,7 @@ public override string Convert(long input) } } - return string.Join("", parts); + return string.Concat(parts); } public override string ConvertToOrdinal(int number) => diff --git a/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs index e0c1beb37..4e9ef1f24 100644 --- a/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs @@ -94,7 +94,7 @@ public override string Convert(long input) } } - return string.Join("", parts); + return string.Concat(parts); } public override string ConvertToOrdinal(int number) => diff --git a/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs index 425b92d71..c46056317 100644 --- a/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs @@ -163,7 +163,7 @@ static string GetPrefix(int number) parts.Add(number == 1 ? "одно" : UnitsOrdinalPrefixes[number]); } - return string.Join("", parts); + return string.Concat(parts); } static void CollectParts(ICollection parts, ref long number, long divisor, GrammaticalGender gender, params string[] forms) diff --git a/src/Humanizer/StringDehumanizeExtensions.cs b/src/Humanizer/StringDehumanizeExtensions.cs index fb0829faf..c5242a92d 100644 --- a/src/Humanizer/StringDehumanizeExtensions.cs +++ b/src/Humanizer/StringDehumanizeExtensions.cs @@ -13,7 +13,7 @@ public static class StringDehumanizeExtensions public static string Dehumanize(this string input) { var pascalizedWords = input.Split(' ').Select(word => word.Humanize().Pascalize()); - return string.Join("", pascalizedWords).Replace(" ", ""); + return string.Concat(pascalizedWords).Replace(" ", ""); } } }