CamelCaseToHumanCase

public static IEnumerable<string> SplitCamelCase(this string source)
{
    const string pattern = @"[A-Z][a-z]*|[a-z]+|\d+";
    var matches = Regex.Matches(source, pattern);
    foreach (Match match in matches)
    {
        yield return match.Value;
    }
}

public static string CamelCaseToHumanCase(this string source)
{
    var words = source.SplitCamelCase();
    string humanCased = string.Join(" ", words);
    return humanCased;
}
Example:
string camelCaseString = "CamelCaseString";
string humanCased = stringForSplit.CamelCaseToHumanCase();
// Result: "Camel Case String"

Description

Turn any string formed with camel case into a human cased string.

Details

Double click on the code to select all.

 

;