Click here to Skip to main content
15,910,471 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
all Name in database is in caps letter. for ex: COMPANY DETAILS.


but i need to show in website like Company Details. is it possible?
can we get like Company Details. Is it possible?
Posted

You can use the .ToTitleCase Method same as you use .ToUpper or .ToLower
 
Share this answer
 
Comments
Adarsh chauhan 8-Nov-13 7:03am    
.ToTitleCase is not available in VS 3.5 or lower versions.. Is there any way( other than writing a user defined function) to achieve this??
[no name] 8-Nov-13 7:44am    
What version is he using?
Adarsh chauhan 10-Nov-13 23:48pm    
I don't know.. I am asking this for me, if there is any way, as I will do it by writing function ( In case of VS 3.5)
If you wanted to do this in SQL there is no straight way to do this. But by the help of creating Functions you can achieve this. To know more in details refer here,

http://blog.sqlauthority.com/2007/02/01/sql-server-udf-function-to-convert-text-string-to-title-case-proper-case/[^]
http://stackoverflow.com/questions/16458112/change-lower-case-to-upper-title-case-using-sql-query[^]
 
Share this answer
 
 
Share this answer
 
Check with this

string strTest = "HELLO THIS IS FOR TEST";
            string strTestLower = strTest.ToLower();
            System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
            System.Globalization.TextInfo textInfo = cultureInfo.TextInfo;
            string MyText = textInfo.ToTitleCase(strTestLower);


Hope this helps!!!
 
Share this answer
 
v2
VB
Private Function ConvertToTitlelCase(ByVal phrase As String) As String
        Dim splittedPhrase() As String = phrase.Split(Microsoft.VisualBasic.ChrW(32), Microsoft.VisualBasic.ChrW(45), Microsoft.VisualBasic.ChrW(46))
        Dim sb As var = New StringBuilder
        'sb.Append(splittedPhrase[0].ToLower());
        'splittedPhrase[0] = string.Empty;
        For Each s As String In splittedPhrase
            Dim splittedPhraseChars() As Char = s.ToCharArray
            If (splittedPhraseChars.Length > 0) Then
                splittedPhraseChars(0) = New String(splittedPhraseChars(0), 1).ToUpper.ToCharArray(0)
            End If
            sb.Append(New String(splittedPhraseChars))
        Next
        Return sb.ToString
    End Function
 
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