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'.  

    http://support.microsoft.com/kb/312890/EN-US/

    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" 

    x[0].ToUpper();

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

Contribute

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.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens