C# string extension methods to convert Pascal case to Space case, strip and collapse whitespace.
public static string PascalToSpaced(this string pascal)
{
return Regex.Replace(pascal, @"([A-Z])", match => " " + match.Value.ToLower()).Trim();
}
public static string StripWhitespace(this string input)
{
return Regex.Replace(input, @"[\r\n\t\s]", "");
}
public static string CollapseWhitespace(this string input)
{
var collapseWhitespace = Regex.Replace(input, @"[\r\n\t\s]+", " ");
return collapseWhitespace;
}