SplitPascalCase

/*
Requires a reference System.Text.RegularExpressions.
*/

/// <summary>
        /// Splits the string by pascal case.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns></returns>
        public static string SplitPascalCase(this string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return text;
            }
            return Regex.Replace(text, "([A-Z])", " $1", RegexOptions.Compiled).Trim();
        }
Example:
var str = "ThisIsAPascalCaseString";
return str.SplitPascalCase();

/*
"This Is A Pascal Case String"
*/

Description

Splits the given string by pascal case.

Details

Double click on the code to select all.

 

;