Skip to content

Instantly share code, notes, and snippets.

@davidvesely
Created January 7, 2022 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidvesely/f1a3336e666627ff259c3869d61dcd3d to your computer and use it in GitHub Desktop.
Save davidvesely/f1a3336e666627ff259c3869d61dcd3d to your computer and use it in GitHub Desktop.
Split PascalCase to words
string[] tests = {
"AutomaticTrackingSystem",
"XMLEditor",
"AnXMLAndXSLT2.0Tool",
};
Regex r = new Regex(@"(?<=[A-Z])(?=[A-Z][a-z])|(?<=[^A-Z])(?=[A-Z])|(?<=[A-Za-z])(?=[^A-Za-z])");
foreach (string test in tests)
{
Console.WriteLine(r.Replace(test, " "));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment