Skip to content

Commit f65ffbf

Browse files
author
Yulian Ashikov
committed
Code refactoring
1 parent 254e3d0 commit f65ffbf

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

src/OneBitSoftware.Slovom/Currencies/NumberWordsVocabulary.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
/// </remarks>
1111
public sealed record NumberWordsVocabulary
1212
{
13+
internal NumberWordsVocabulary() { }
14+
1315
/// <summary>
1416
/// Gets or inits the word representation for the singular form of the minor currency unit.
1517
/// </summary>

src/OneBitSoftware.Slovom/NumbersToWords.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
public static class NumbersToWords
66
{
7-
private static string ConvertWholeNumber(int number, NumberWordsVocabulary numberWordsVocabulary)
8-
{
9-
return number switch
7+
private static string ConvertWholeNumber(int number, NumberWordsVocabulary numberWordsVocabulary) =>
8+
number switch
109
{
1110
< 20 => numberWordsVocabulary.NumbersZeroToNineteen[number],
1211
< 100 => Tens(number, numberWordsVocabulary),
@@ -15,7 +14,6 @@ private static string ConvertWholeNumber(int number, NumberWordsVocabulary numbe
1514
< 100000 => TensOfThousands(number, numberWordsVocabulary),
1615
_ => "Числото е твърде голямо"
1716
};
18-
}
1917

2018
private static string Tens(int n, NumberWordsVocabulary numberWordsVocabulary)
2119
{
@@ -122,15 +120,9 @@ private static string TensOfThousands(int number, NumberWordsVocabulary numberWo
122120
return BuildThousandsWithoutAnd(Tens(i, numberWordsVocabulary), Hundreds(e, numberWordsVocabulary));
123121
}
124122

125-
private static string BuildThousandsWithoutAnd(string thousands, string afterThousands)
126-
{
127-
return thousands + " хиляди " + afterThousands;
128-
}
123+
private static string BuildThousandsWithoutAnd(string thousands, string afterThousands) => thousands + " хиляди " + afterThousands;
129124

130-
private static string BuildThousandsWithAnd(string thousands, string afterThousands)
131-
{
132-
return thousands + " хиляди и " + afterThousands;
133-
}
125+
private static string BuildThousandsWithAnd(string thousands, string afterThousands) => thousands + " хиляди и " + afterThousands;
134126

135127
public static string Convert(decimal number, CurrencyDescriptor currencyDescriptor)
136128
{

0 commit comments

Comments
 (0)