Humanizr / Humanizer

Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ncosentino opened this issue · comments

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.