How To Capitalize All First Letters Of Words In String In C#

This is the simple and logic building exercise in C#. The program will capitalize all first letters of the words in the given string in java e.g. given string "proprogrammer" will become "Proprogrammer".

Source Code 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace capitalizeFirst
{
class Program
{
static void Main(string[] args)
{

//Your code goes here
Console.WriteLine("Hello, world!");
String userEntered = "";
Console.WriteLine("Enter some text to capitalize first letter");
userEntered = Console.ReadLine();
Console.WriteLine(userEntered.First().ToString().ToUpper() + userEntered.Substring(1));
userEntered = Console.ReadLine();
}
}
}

Output of the Program


Capitalize All First Letters Of The Words In The Given String In Java

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment