Capitalizing words in a string using c#

前端 未结 10 1336
攒了一身酷
攒了一身酷 2020-12-16 11:22

I need to take a string, and capitalize words in it. Certain words (\"in\", \"at\", etc.), are not capitalized and are changed to lower case if encountered. The first word s

10条回答
  •  悲哀的现实
    2020-12-16 12:07

    Here is answer How to Capitalize names

    CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
    TextInfo textInfo = cultureInfo.TextInfo;
    
    Console.WriteLine(textInfo.ToTitleCase(title));
    Console.WriteLine(textInfo.ToLower(title));
    Console.WriteLine(textInfo.ToUpper(title));
    

提交回复
热议问题