Skip to content

Commit

Permalink
ToEnglishWords fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyPatten committed Aug 17, 2021
1 parent 964f524 commit 7aad042
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -271,6 +271,8 @@
>
> string ToEnglishWords(this decimal @decimal);
> // Example: 42 -> "Forty-Two"
> (bool Success, decimal Value) TryParseEnglishWordsToDecimal(string words);
> // Example: "Forty-Two" -> 42
>
> int TryParseRomanNumeral(string @string);
> // Example: "XLII" -> 42
Expand Down
4 changes: 4 additions & 0 deletions Sources/Towel/Extensions-NumericEnglishWords.cs
Expand Up @@ -128,6 +128,10 @@ internal static string ToEnglishWords(ReadOnlySpan<char> number)
decimalIndex = -1;
}
}
if (number.Length is 0)
{
return "Zero";
}
if (decimalIndex is not 0)
{
ReadOnlySpan<char> wholeNumber = decimalIndex >= 0
Expand Down
2 changes: 2 additions & 0 deletions Tools/Towel_Testing/Extensions-NumericEnglishWords.cs
Expand Up @@ -181,6 +181,8 @@ public partial class Extensions_Testing

(-0.0100m, "Negative One Hundredths"),

(-0.0000m, "Zero"),

(decimal.MinValue, "Negative Seventy-Nine Octillion Two Hundred Twenty-Eight Septillion One Hundred Sixty-Two Sextillion Five Hundred Fourteen Quintillion Two Hundred Sixty-Four Quadrillion Three Hundred Thirty-Seven Trillion Five Hundred Ninety-Three Billion Five Hundred Forty-Three Million Nine Hundred Fifty Thousand Three Hundred Thirty-Five"),
(decimal.MaxValue, "Seventy-Nine Octillion Two Hundred Twenty-Eight Septillion One Hundred Sixty-Two Sextillion Five Hundred Fourteen Quintillion Two Hundred Sixty-Four Quadrillion Three Hundred Thirty-Seven Trillion Five Hundred Ninety-Three Billion Five Hundred Forty-Three Million Nine Hundred Fifty Thousand Three Hundred Thirty-Five"),
};
Expand Down

0 comments on commit 7aad042

Please sign in to comment.