Often we need to capitalize the first letters of some word or some text
(for example when we want to display users name ,second Name).
Since string class does not have a method to do this we could think that there is no built-in solution in C# for this problem...
But a little digging trough MSDN would help us find ToTitleCase method of TextInfo class in System.Globalization namespace that does exactly what we need: capitalizes the first letter of each word in the string.
Here is a example for this
using System.Globalization;
string str = CultureInfo.CurrentCulture.TextInfo.ToTitleCase("indians are rocks!!!");
Console.WriteLine(str);
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Ravi K KashyapPosted May 25, 2011, 10:00 AM
great to know this :)
Mayur GujrathiPosted May 25, 2011, 5:12 AM
Useful R & D Ankit Keep rocking
Ankit NandekarPosted May 25, 2011, 2:50 AM
thnx Diptimaya
Diptimaya PatraPosted May 25, 2011, 2:24 AM
Nice find.