One-liner for splitting Pascal Casing …

Today I had to write a method for splitting Pascal Cased property names to readable text strings. Because I found a small and stylish solution, I want to show you.

string outputString = System.Text.RegularExpressions.Regex.Replace(
inputString, "([a-z])([A-Z])", "$1 $2", System.Text.RegularExpressions.RegexOptions.Compiled);

Hope you like it
Cheers
– Gerhard

kick it on DotNetKicks.com

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 106 other followers

%d bloggers like this: