capitalize c#

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)
				)
		);

3.67
3
SolarBear 85 points

                                    public static class StringExtension
{
    public static string CapitalizeFirst(this string s)
    {
        bool IsNewSentense = true;
        var result = new StringBuilder(s.Length);
        for (int i = 0; i < s.Length; i++)
        {
            if (IsNewSentense && char.IsLetter(s[i]))
            {
                result.Append (char.ToUpper (s[i]));
                IsNewSentense = false;
            }
            else
                result.Append (s[i]);

            if (s[i] == '!' || s[i] == '?' || s[i] == '.')
            {
                IsNewSentense = true;
            }
        }

        return result.ToString();
    }
}

3.67 (3 Votes)
0
4.1
10

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

//prints "Hello!"

4.1 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to get alphabet in small letter from capital using c# change first letter of string to uppercase c# how to auto capitalize first letter in c# dot net capitalise first letter find capital letter in string c# c# capitalize first letter and lowercase rest WORD how to capitalize first letter in c# c# capital case transform string to only first letter capital c# c# make first letter upper how to change first letter to lowercase in C# string only first capital letter c# string in capital letter c# c# regex first letter uppercase then lowercase c# regex first letter uppercase capitalize words c# textbox first letter capital in c# first letter of string uppercase c# c# string capitalize c# first character uppercase rest in lowercase c# convert string first character uppercase capital letters first word in C# capitalize string c# c# how get english capital letters from string char uppercase c# c# make first letter capital c# program to capitalize first letter senetnce in a string c# program to capitalize first letter of every word in a string c# put first letter upper string to first letter uppercase c# c# first uppercase c# method capitalization make first letter of string aray uppercase c# c# uppercase first letter of each word how to make the first letter capital in c# convert first letter to uppercase in c# character to uppercase c# c# capitalise first letter of each word c# first character to upper make values uppercase c# upper case to first letter in C# capitalise string c# csharp capitalize csharp capitalize first letter c# text capitalize first letter capitalize the first letter in c# string capital letter c# c# turn first word into capital letter to capital character c# c# string uppercase first letter each word c# string capital first letter how to change the first char of a string to uppercase c# c sharp capitalize first letter capitalize words of a string c# c# capitalize a sentence c# get capital letters from string c# toupper only first character c sharp first letter uppercase how to change first letter capital in C# c# capitalize char upper case letter C# capital s String c# capitalize string in s c sharp c# first letter lowercase control first letter of a word need to be uppercase in c# c# capitalize first letter of each word how to convert letters to capital in c# c# convert string to capital letters c# string capitalize first letter of each word dotnet string capitalize dot net string capitalize c# uppercase sentence C# capitalize C# lowercase first capitalize first letter in c# c# make first character uppercase c# first char to upper first char to upper c# c# first letter cap c# property capitalization capitalize first letter of each word in string c# capitalize first letter of word in c# string c# first letter uppercase c# regex make all the first letter uppercase in string how to capitalize first letter of a string in c# how to capitalize a string in c# c# first letter capital string first char to upper c# capitalize first letter of the name c# c# make first character of string array to uppercase c# first letter to caps c# set first letter uppercase c# make upper case first letter uppercase password c# lowercase first letter c# c# uppercase first character how to make the first letter uppercase in c# c# lowercase first letter first letter uppercase c# uppercase c# string to capitalze c# c# upper case first letter how to capitalize all first letters in c# tolower first letter c# capitalize first char of string c# c# first character of string uppercase capitalize first letter of each word in a string in c# c# string first letter lowercase capitalize first letter in string c# c# variables capital letter c# first letter small c# how to capitalize first letter upper start letter c# c# capitalize string set first letter to uppercase c# how to spelling first character in capital using c# convert string first case to upper in c# string make all capital letters c# string c# uppercase first letter capitalize first character of string c# c# make first letter of each word uppercase make first letter of a string uppercase c# how to make first character caps in c# uppercase en c# example uppercase en c# make first letter uppercase regex C# asp.net capitalize first letter make all letter uppercase C# C# make first letter uppercase rest lowercase c# first letter uppercase c# first letter to uppercase c sharp upper case first letter c# first letter to upper case get the first letter of a string c# c# regex replace first character to uppercase c# regex uppercase first letter c# string starts with capital letter capitalise first letter of string c# c# toupper first letter How to put a string capital letters c# C# to formart string to have Uppercase on first letter of each word C# capilise first letter string.touppercase first letter c# convert each first letter to uppercase in c# how to first letter capital in c# c# is capital letter c# first letter to capital c# format string first letter uppercase 1st letter capital c# c# string make first letter uppercase convert first letter of each word to uppercase in c# c# capitalise first letter word first character uppercase c# c# convert first letter to uppercase capital first letter in c# c# set first character of string to upper c# string set first letter uppercase uppercase first csharp c# first letter to upper c# just capitalize first char capitalise first letter c# built in fn c# capitalize first letter method first letter of string toupper C# uppercase first letter c# c# find first capital letter lowercase first letter of variable c# string first letter uppercase c# upper first character c# how do you make a letter capital in c# string first letter capital c# c# make string first letter capital c# make first letter lowercase how to get the first letter in a string to upper case c# c# first char uppercase convert first letter of string to uppercase c# c# first character uppercase C# string to lower with uppercase first letter c# string first letter uppercase to capitalize c# .net first letter uppercase convert first letter to uppercase c# string capital first letter c#\ take capital letters in c# return first letter uppercase c# capitalise first letter c# c# force two first letters of a string to become uppercase get the first letter of the string and make it capitalize c# how to make console allways write UppewrCase first letter C# c# to upper first letter c# how to write a code that uppercase the first letter only how to write a code that upcase the first letter only c# how to convert two words that are uppercase to lower case with the first letter capitalized c# cap first letter in string c# make first 2 words upper case c# make first 2 works upper case c# c# string turn first letter to Uppercase c# string turn first letter to Uppercastr c# mvc string first letter uper how to make first word capital of a string in c# first work capital letter in a word in c# c# Capital letter you need a capital letter to sign up c# capitalize first letter of each word c# how to capitalize the first word of every sentance in a string c# how to make first letter of every word always capital in c# how to make first word always capital in c# capitalize first letter of each word of an enumarable c# how to give a char to a string first letter c# c# first letter uppercase each word how to captialize first letter in a word on property get C# make char to uppercase in C# c# first char upper case c# convert string to first letter uppercase how to make first letter of word capital in c# C# convert first letter of a string to uppercase GET upper casr haracter from string c3 how to make first character in uppercase in c# C# first letter big c# day big first letter c# capitalize first letter of every word how to make first character of each word in uppercase in c# capalize letters string C# how to chage first letter to upper c# make first letter capital c# first letter to uppercase c# convert first character of string to uppercase c# how to make 1st letter capital in c# convert first character to uppercase in c# how to make first letter capital and other small in c# make first letter of word uppercase c# string function to make first letter capital in c# capitalise the first letter C# c# upper first letter c# make first letter uppercase Capitalize in c# how to capitalize the first letter of a string in c# capitalizing each word in a string c# c# capital first letter c# string to capital first letter capitalize the first letter c# how to change the first letter to capital c# text to first uppercase + c# c# code for capitalize c# string capitalised latter c# capitalize first letter of sentence string to uppercase unity c# fiorst caracter to uppercase c# how to show first letter capital in c# first letter capital c# how to capitalize the first letter of a string c# how to convert first letter of each string to uppercase in c# how to convert first letter of a string to uppercase in c# make first letter capitalization word c# c# set first character to uppercase C# first maj letter capitalize the first letter only c# first character uppercase c# how to make a sentence capitalize in c# first letter capital in c# convert first char in string to upper c# string format c# capitalize first letter cpatial lize first letter c# first character of string uppercase c# c# string first character uppercase C# cap first letter c# string capitalize first letter c# capitalize first letter of string capitalize c# capitalization first word in a sentence c# c# first letter of each word uppercase c# string capitalize only first letter c sharp string capitalisfirst letter upper first letter c# make first letter uppercase c# visual studio uppercase the first letter c# capitalize first word of string c# C# caplitlize first letter from array of strings c# each letter in sentence uppercase string format lowercase with first letter capitalize the letter I in c# make first letter uppercase c# capitalized string c# make string capitalize c# capital aletter in C# capitalize first letter c# capitalize first letter each word c# c# capital a first letter c# uppercase first letter only c# uppercase first letter How to uppercase first letter in a string C# c# string uppercase first letter CapitalizeFirstLetters All Word c# c sharp uppercase first letter php first letter capital c# capitalize first letter first sentence letter capital in c#
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source