-
08-11-2010, 07:23 PM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,122
- Thanks
- 742
- Thanked 674 Times in 543 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
How to Convert String to Title Case - ASP .NET
How to Convert String to Title Case - ASP .NET
Often times you might need to convert input string to title case.
For example converting the string "mY GiaNT bREAkFST" to "My Giant Breakfast"
Using this simple method you could convert an input string to title case
public class Converter
{
public static string ConvertToTitleCase(string input)
{
TextInfo ti = Thread.CurrentThread.CurrentCulture.TextInfo;
//if a word is all in upper case, ToTitleCase method is not able to convert to title case. So we would make the input string all lower case.
return ti.ToTitleCase(input.ToLower());
}
}
To use this method you can simply call the static method like this:
string str = Converter.ConvertToTitleCase("mY GiaNT bREAkFST")
-
09-03-2010, 09:30 AM #2
thanks
thanks Dear sharing information
Similar Threads
-
Replace String Ignoring Case - ASP .NET
By manik in forum ASPReplies: 0Last Post: 03-30-2010, 04:11 PM -
Splitting a string in coldfusion
By Abina in forum ColdFusionReplies: 1Last Post: 02-02-2010, 12:17 PM -
Explode a string?
By Abina in forum ColdFusionReplies: 1Last Post: 02-02-2010, 12:11 PM -
Unterminated String constant
By sunshine in forum JavaScript & AJAXReplies: 0Last Post: 01-04-2010, 12:23 PM


Reply With Quote


