var testString = "ABCD efgh iJkl";testString = string.Join(" ", testString.Split(' ').Select(CapitalizeFirstLetter).ToArray());private static string CapitalizeFirstLetter(string str) { if (string.IsNullOrWhiteSpace(str)) return str; return str.Length == 1 ? str.ToUpper() : char.ToUpper(str[0]) + str.Substring(1).ToLower(); }
var testString = "ABCD efgh iJkl";
testString = string.Join(" ", testString.Split(' ').Select(CapitalizeFirstLetter).ToArray());
private static string CapitalizeFirstLetter(string str)
{
if (string.IsNullOrWhiteSpace(str)) return str;
return str.Length == 1 ? str.ToUpper() : char.ToUpper(str[0]) + str.Substring(1).ToLower();
}
http://www.c-sharpcorner.com/code/2637/how-do-i-capitalize-first-letter-of-string-in-C-Sharp.aspx
Here is a simple solution string str = "hello world";str = str.ToLower();string[] strarray = str.Split(' ');foreach(string st in strarray){char[] ch = st.ToCharArray();ch[0] = char.ToUpper(ch[0]);str += " " + new string(ch);}Console.WriteLine(str.ToString());Out put will :Hello World