Click here to Skip to main content
15,887,676 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

Convert text to TitleCase

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
23 Feb 2010CPOL 7K   1
also..Syst...
also..
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US");
<big>System.Globalization.TextInfo myTextInfo = ci.TextInfo;</big>
string sampleStr = "this IS a sample text"; 
string titleStr = myTextInfo.ToTitleCase(sampleStr);
Console.WriteLine(titleStr);
Console.ReadLine();

License

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


Written By
Software Developer Kovair Inc.
India India
I have started programming in 10 years on Fortran 77.Then it was Cobol,C,C++,JAVA 1.2, ASP,JavaScript. Now it at all C# and .NET Framework, such tehnologies as WCF, ADO.NET, ASP.NET, LINQ, ASP.NET Ajax , FLEX and another.

Comments and Discussions

 
GeneralReason for my vote of 3 Same problem as the original method ... Pin
yannduran23-Aug-11 18:19
yannduran23-Aug-11 18:19 
Reason for my vote of 3
Same problem as the original method in the article, unfortunately.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.