Answers for "c# capitalize full string"

C#
1

c# capitalize first letter

string text = "john smith";

// "John smith"
string firstLetterOfString = text.Substring(0, 1).ToUpper() + text.Substring(1);

// "John Smith"
// Requires Linq! using System.Linq;
string firstLetterOfEachWord =
		string.Join(" ", text.Split(' ').ToList()
				.ConvertAll(word =>
						word.Substring(0, 1).ToUpper() + word.Substring(1)
				)
		);
Posted by: Guest on May-25-2020
1

capitalize c#

string input = "hello!";
Console.Write(char.ToUpper(input[0]) + input.Substring(1))

//prints "Hello!"
Posted by: Guest on April-11-2021

C# Answers by Framework

Browse Popular Code Answers by Language