Skip to content
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

Merged
merged 2 commits into from
Jul 3, 2014
Merged

NumberToWord Turkish implementation #312

merged 2 commits into from
Jul 3, 2014

Conversation

erdemergin
Copy link
Contributor

NumberToWord Turkish implementation with unit tests

NumberToWord implementation with unit tests
@mexx mexx merged commit 252737f into Humanizr:master Jul 3, 2014
mexx added a commit that referenced this pull request Jul 3, 2014
var hundred = (number / 100);
if (hundred > 0)
{
parts.Add(string.Format("{0} yüz", hundred > 1 ? Convert(number / 100) : "").Trim());
Copy link
Collaborator

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

@mexx
Copy link
Collaborator

mexx commented Jul 3, 2014

@erdemergin I've merged the PR already and found the code issues afterwards, can you address them in a new PR.
@MehdiK Sorry, I was to fast at merging it.

@@ -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
Copy link
Member

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.

@MehdiK
Copy link
Member

MehdiK commented Jul 3, 2014

@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++)
Copy link
Collaborator

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

@mexx
Copy link
Collaborator

mexx commented Jul 3, 2014

@erdemergin As I was to fast at merging it, I've corrected the problems mentioned after the merge.
@MehdiK I promise to do better next time ;)

@MehdiK
Copy link
Member

MehdiK commented Jul 7, 2014

This is now available on NuGet as v1.28.0. Thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants