-
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
NumberToWord Turkish implementation #312
Conversation
NumberToWord implementation with unit tests
var hundred = (number / 100); | ||
if (hundred > 0) | ||
{ | ||
parts.Add(string.Format("{0} yüz", hundred > 1 ? Convert(number / 100) : "").Trim()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could reuse the already calculated hundred
value
@erdemergin I've merged the PR already and found the code issues afterwards, can you address them in a new PR. |
@@ -2,6 +2,7 @@ | |||
- [#306](https://github.com/MehdiK/Humanizer/pull/306): Added Singularize/Pluralize overload without using obsolete plurality enum | |||
- [#303](https://github.com/MehdiK/Humanizer/pull/303): Added support for all integer types in ByteSize extensions | |||
- [#307](https://github.com/MehdiK/Humanizer/pull/307): Added support to string.FormatWith for the explicit culture parameter. | |||
- [#312](https://github.com/MehdiK/Humanizer/pull/312): Added Turkish NumberToWord implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should indicate that Ordinalizer is added too.
@mexx That's cool. Thanks for tackling it |
var wordChars = word.ToCharArray().Reverse().ToArray(); | ||
var suffixFoundOnLastVowel = false; | ||
|
||
for (int i = 0; i < wordChars.Count(); i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can iterate in reverse order over the word
for (var i = word.Length - 1; i >= 0; i--)
and you can remove the copy wordChars
@erdemergin As I was to fast at merging it, I've corrected the problems mentioned after the merge. |
This is now available on NuGet as v1.28.0. Thanks for the contribution. |
NumberToWord Turkish implementation with unit tests