String conversion from uppercase to lower case only first character...........?

csharp Antarctica
  • 12 years ago

     hi friends i want convert string uppercase to lower case.
    means for example string="RHOIT SHARMA"
    I want string like this "Rhoit Sharam"

    onle first character..any idea

  • 12 years ago

    The following describes this in more detail where it is referred to as 'title case'.

    Essentially, this is what you do: 

    CultureInfo cultureInfo   = Thread.CurrentThread.CurrentCulture;
    TextInfo textInfo = cultureInfo.TextInfo;

    string myName ="RHOIT SHARMA";
    string myNameProper = textInfo.ToTitleCase(myName));



  • 12 years ago

    string x="RHOIT SHARMA" 


    because string is array of char

    i use the first element of array

    and use method ToUpper( );

    if you want to chang to lowercase

    use method ToLower( ); 

  • 12 years ago

    My understanding of the original post is that both the R and S in "RHOIT SHARMA" has to be capitalised.

    So using the above approach, you would have to search for spaces in the text and capitalise the following character or split the orginal string into an array and work on it that way.   

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold