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

string.Humanize(LetterCasing.Title) Has Different Behavior Than To.TitleCase Extension (Symbols) #1283

Open
ncosentino opened this issue Jul 4, 2023 · 0 comments

Comments

@ncosentino
Copy link

Hey there, I am working on some parsing functionality where I need to handle unstructured data and get it into a good format. Humanizer is perfect for normalizing this stuff afterward, but I've noticed some inconsistency in the behavior.

The sample string I have is:
1" wedge

I would like this to say:
1" Wedge
(Just a capital on the W).

If I use the following:
"1\" Wedge".Humanize(LetterCasing.Title)

I get:
1 Wedge

Note that the entire double quote is removed (which is supposed to represent 1 inch).

I found To.TitleCase extension method, and this does exactly what I would expect:
To.TitleCase.Transform("1\" Wedge", CultureInfo.InvariantCulture)

Which has this result:
1" Wedge

Note that the double quote is not removed. So this "solves" my problem, but I think this is demonstrating what I would consider to be inconsistent formatting between these two things. Why does one seem to strip symbols/punctuation but the other keeps them?

I am using Humanizer.Core v2.14.1 Nuget in my .NET 7 application.

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

1 participant