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

Clarified what is treated as an acronym. #316

Merged
merged 2 commits into from
Jul 10, 2014
Merged

Conversation

iadaz
Copy link
Contributor

@iadaz iadaz commented Jul 8, 2014

No description provided.

"HTML".Humanize() => "HTML"
```

Note that a string that contains only upper case letters, and consists only of one word, is always treated as an acronym (regardless of its length).
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the PR. Maybe provide an example of what you mean. Also provide the workaround for how to deal with them when we want a different treatment, as discussed in #287.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to add an example, just wasn't sure how big you wanted that readme to get.

Would you say this is the most appropriate method of ensuring an arbitrary string will be transformed to title case?

"HUMANIZER".Humanize(LetterCasing.LowerCase).Humanize(LetterCasing.Title) => "Humanizer"

This does seem a bit clunky to me, at least from the perspective of someone working with data that's already mostly human readable (as opposed to acronyms and techy things). I wonder if you think some sort of global switch to ignore all acronyms would be appropriate?

Copy link
Member

Choose a reason for hiding this comment

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

You can use transforms for that; e.g. "HUMANIZER".Transform(To.LowerCase | To.TitleCase).

But you have a good point there. Maybe we should allow that to be treated differently with a config or param.

Additional examples of strings treated as acronyms, with workaround using Transform() method.
@iadaz
Copy link
Contributor Author

iadaz commented Jul 10, 2014

I've expanded the explanation of the acronym handling and added the workaround as discussed. When I get time I'll look into adding some sort of switch.

Perhaps if there was a property such as MaxAcronymLength, with a default of say 20, then the existing functionality was used for strings up to that length. Setting this to zero would effectively turn off the acronym behaviour.

MehdiK added a commit that referenced this pull request Jul 10, 2014
Clarified what is treated as an acronym.
@MehdiK MehdiK merged commit 63ba28d into Humanizr:master Jul 10, 2014
@MehdiK
Copy link
Member

MehdiK commented Jul 10, 2014

Thanks for the addition and the suggestion. Looking forward to seeing your solution for the switch.

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