Skip to content

Double Barrel Name conversion #620

Closed
@archergod

Description

@archergod

I like the library but it add a value if you can include Name Casing (I call it like that), along with TitleCase. The idea is to change Double Barrel name and name like O'Neil to be properly cased. I wrote a novice function for it using Humanizer itself

   public static string ToNameCase(string name)
    {
        string x = name.Replace("-", " #7# " ).Replace("'", " $7$ ");
        x = x.ToLower().Transform(To.TitleCase);
        return x.Replace(" #7# ", "-").Replace(" $7$ ", "'");
    }

It does both, but I am not sure how to improve it further, my idea is to write it in Regular expression for better results, but for now it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions