The problem
I was working on an application when suddenly I stepped into a method that intrigued me.
public static string NameFormatter(string name) { if (!String.IsNullOrEmpty(name)) { int index = 1; char[] separator = new[] { ' ', '-', '_', '.', '\'' }; name = name.Substring(0, 1).ToUpper() + name.Substring(1); while ((index = name.IndexOfAny(separator, index)) > 0) { index++; if (name.Length > index + 1) { name = name.Replace( name.Substring(index, 1), name.Substring(index, 1).ToUpper()); } } } return name; }