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

Single word casing not working as expected #287

Closed
dommyzee opened this issue May 29, 2014 · 5 comments
Closed

Single word casing not working as expected #287

dommyzee opened this issue May 29, 2014 · 5 comments

Comments

@dommyzee
Copy link

I've noticed that single word casing isn't working. For example

string text = "WOOLWICH";

// --- Working ---
// Expected: WOOLWICH
// Actual: WOOLWICH
text.Transform(To.AllCaps); 

// Expected: woolwich
// Actual: woolwich
text.Transform(To.LowerCase);

// --- NOT Working ---
// Expected: Woolwich
// Actual: WOOLWICH
text.Transform(To.SentenceCase);

// Expected: Woolwich
// Actual: WOOLWICH
text.Transform(To.TitleCase);
@dommyzee dommyzee changed the title Feature Request: Single word casing Single word casing not working as expected May 29, 2014
@MehdiK
Copy link
Member

MehdiK commented May 29, 2014

This is the expected behavior. All caps is considered an extreme case and is usually left untouched. The reason for this is that all-caps is usually an indication of acronym (e.g. HTML) in which case you really don't want to mess with it. The only transformation that does change that is ToLower and the thinking behind that was that if you DO decide to mess with an all-caps you should have a way; so you could go text.Transform(To.LowerCase) to make it all lower case or text.Transform(To.LowerCase | To.TitleCase) to turn it into title case.

I hope this answers your question.

Going to close this now; but happy to discuss further.

@MehdiK MehdiK closed this as completed May 29, 2014
@dommyzee
Copy link
Author

The combination you provided worked perfectly!

[image: Inline images 1]

On 29 May 2014 14:24, Mehdi Khalili notifications@github.com wrote:

Closed #287 #287.


Reply to this email directly or view it on GitHubhttps://github.com//issues/287#event-125981048
.

@iadaz
Copy link
Contributor

iadaz commented Jul 7, 2014

This puzzled me too. I'm using Humanizr to prettify addresses that have been stored entirely capitalised, some of these will be single word strings and some won't.

Might be worth adding a note to the documentation that any capitalised upper case string of any length is considered an acronym.

Other than that, great library!

@MehdiK
Copy link
Member

MehdiK commented Jul 8, 2014

Good point. You know you can send me a PR for that, right? :)

@iadaz
Copy link
Contributor

iadaz commented Jul 8, 2014

You got it!

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

No branches or pull requests

3 participants