Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I want to print the very first letter to capital from a group of words, when i try with vbpropercase it converts first letter of each word to capital. But i do not want that.

Eg., shipping company
should be printed as Shipping company instead of Shipping Company

Help ASAP.

Thanks in advance.
Posted
Updated 6-Apr-13 0:43am
v2

 
Share this answer
 
v2
C#
private string FirstLetterToUpper(string word)
{
    StringBuilder sb = new StringBuilder();
    if (!string.IsNullOrWhiteSpace(word))
    {
        sb.Append(word.Substring(0, 1).ToUpper());
        sb.Append(word.Substring(1, word.Length - 1));
    }
    return sb.ToString();           
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900