Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 6-Apr-13 0:36am
Edited 6-Apr-13 0:43am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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();           
}
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 445
1 CHill60 410
2 Sergey Alexandrovich Kryukov 354
3 BillWoodruff 190
4 PIEBALDconsult 160


Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 8 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100