CSharp examples for System:String Convert
Convert a classname to something more readable. ex.: CreateATable => Create a table
using System.Text.RegularExpressions; using System.Text; public class Main{ /// <summary> /// Convert a classname to something more readable. /// ex.: CreateATable => Create a table /// </summary> /// <param name="className"></param> /// <returns></returns> public static string ToHumanName(string className) {// w w w . jav a 2 s . c om string name = Regex.Replace(className, "([A-Z])", " $1").Substring(1); return name.Substring(0, 1).ToUpper() + name.Substring(1).ToLower(); } }