Skip to main content
Version: 3.0.10 (latest)

Humanizer.StringDehumanizeExtensions

StringDehumanizeExtensions Class

Contains extension methods for dehumanizing strings.

public static class StringDehumanizeExtensions

Inheritance System.Object → StringDehumanizeExtensions

Methods

StringDehumanizeExtensions.Dehumanize(this string) Method

Converts a humanized string back to PascalCase format by removing spaces and capitalizing each word.

public static string Dehumanize(this string input);

Parameters

input System.String

The string to be dehumanized. Must not be null.

Returns

System.String
A PascalCase string with all spaces removed and each word capitalized. If the input is already in PascalCase (contains no spaces), it is returned unchanged.

Example

"some string".Dehumanize() => "SomeString"
"Some String".Dehumanize() => "SomeString"
"Some string".Dehumanize() => "SomeString"
"SomeStringAndAnotherString".Dehumanize() => "SomeStringAndAnotherString" // Already dehumanized, returned unchanged

Remarks

This method reverses the humanization process by: 1. Splitting the input on spaces 2. Humanizing each word (to handle any edge cases) 3. Pascalizing each word (capitalizing first letter) 4. Removing all spaces This is the inverse operation of Humanize(this string).