-
Notifications
You must be signed in to change notification settings - Fork 965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Add overload to Number.ToWords() to not include "AND" #919
Comments
If I understant correctly, the convertion outpu from a number like 3051 return a string in the default english formater that write : |
Correct. Checks are normally written with the “and” between dollars and cents. So a check for $3051.87 would be translated as “three thousand fifty one and 87/100”. Since I am not sure on conventions in other countries the overload to not include the “and” is the most universal way, then users could do what ever with the “three thousand fifty one”. My thoughts were with an overload this could be applicable to all the languages that use similar constructs with a junction word along with the number words. Then languages with out the junction would just return the same output. |
I will see what I can do but and overload would actually be a good idea for this. I'll try to work on this during the week. |
I am working on an accounting application and need to print checks. Humanizer is the best library I have found but there is a small issue. When writing a check amount the value of 3051.82 should be "Three Thousand Fifty One and 82/100". currently I am using the following to build the value
$"{((int) Math.Floor(amount)).ToWords().ToUpper()} AND {((amount- Math.Floor(amount)) * 100).ToString("00")}/100";
However I need to add
.Replace(" AND", "")
becoming$"{((int) Math.Floor(amount)).ToWords().ToUpper().Replace(" AND", "")} AND {((amount- Math.Floor(amount)) * 100).ToString("00")}/100";
Having an overload that could control the additional AND in the string would be more reliable than using a replace after the fact.
I looked through the issues and haven't seen this addressed in the past.
The text was updated successfully, but these errors were encountered: