Hi
I have some text in database like
new delhi
kullu manali . I want to convert them to Propercase
Thanks
Hi
I have some text in database like
new delhi
kullu manali . I want to convert them to Propercase
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tuhin PaulRank #7 · 71.9K reputationPosted Apr 7, 2023, 1:18 PM EDT
You can use the
TextInfo.ToTitleCase()method to convert a string to Propercase.string text1 = "new delhi"; string text2 = "kullu manali"; TextInfo textInfo = new CultureInfo("en-US",false).TextInfo; string properText1 = textInfo.ToTitleCase(text1.ToLower()); string properText2 = textInfo.ToTitleCase(text2.ToLower()); Console.WriteLine(properText1); Console.WriteLine(properText2);We first create a
TextInfoobject using theCultureInfoclass with the language and region settings. Then we use theToTitleCase()method to convert the input string to PropercaseAmit MohantyRank #112 · 20K reputationPosted Apr 7, 2023, 11:59 PM EDT
using System.Globalization; string text = "new delhi, kullu manali"; TextInfo textInfo = CultureInfo.CurrentCulture.TextInfo; string properText = textInfo.ToTitleCase(text); Console.WriteLine(properText); // Output: New Delhi, Kullu ManaliTuhin PaulRank #7 · 71.9K reputationPosted Apr 7, 2023, 1:17 PM EDT
To convert the text in your database to Propercase, you can use a function that capitalizes the first letter of each word in a string.
Ramco RamcoRank #462 · 5.4K reputationPosted Apr 7, 2023, 11:44 PM EDT
Hi Tuhin
Will it always be en-US
Thanks