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

Added ToQuantity - issue #32 #37

Merged
merged 1 commit into from
Dec 30, 2013
Merged

Added ToQuantity - issue #32 #37

merged 1 commit into from
Dec 30, 2013

Conversation

MehdiK
Copy link
Member

@MehdiK MehdiK commented Dec 27, 2013

No description provided.

public static string ToQuantity(this string input, int quantity)
{
if (quantity == 1)
return string.Format("{0} {1}", quantity, input);
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 need to call .Singularize on input, don't we?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, so you think "requests".ToQuantity(1) should return "1 request"? That's a nice observation. I kinda like this. Will add in.

Thanks for the review.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do'h. It turns out there is a bug in Singularize method where calling it on a singular word returns null. Similar bug exists on pluralize where calling pluralize on a plural word returns null or the word postfixed with an s; e.g. men => mens!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened the issue #38 to deal with this issue. When that's done, adding this to ToQuantity will be easier. I am going to leave ToQuantity as is if you don't mind. I also created issue #39 so we won't forget about this issue for ToQuantity.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue should be fixed but #43. I would really appreciate your review.

MehdiK added a commit that referenced this pull request Dec 30, 2013
Added ToQuantity - fixes issue #32
@MehdiK MehdiK merged commit 1784710 into master Dec 30, 2013
@MehdiK MehdiK deleted the ToQuantity branch December 30, 2013 16:24
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.

2 participants