Replace camel cased identifiers with space delimited string. - CSharp System

CSharp examples for System:String Case

Description

Replace camel cased identifiers with space delimited string.

Demo Code


using System.Text.RegularExpressions;
using System.Reflection;
using System.Linq.Expressions;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
using System;/*from  ww  w .  java2  s .co m*/

public class Main{
        /// <summary>
        /// Replace camel cased identifiers with space delimited string.
        /// </summary>
        /// <param name="pascal"></param>
        /// <returns></returns>
        /// <remarks>Used convert assertion method names to failure descriptions</remarks>
        public static string CamelCasedToSpaced(this string pascal)
        {
            return Regex.Replace(pascal, @"([A-Z])", match => " " + match.Value.ToLower()).Trim();
        }
}

Related Tutorials