SplitCamelCase

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;
    }
}
Example:
string stringForSplit = "CamelCaseString";
IEnumerable<string> splittedString = stringForSplit.SplitCamelCase();
// Result: collection with the strings "Camel" "Case" "String"

Description

Split any string using camel case pattern.

Details

Double click on the code to select all.

 

;