如何利用名称名称

由网友(迢迢相思意)分享简介:所以基本上,如果我想从so basically if i want to transform a name fromstephen smith 到Stephen Smith我可以很容易地做到这一点与CSS来在页面上,但最好我想在前面抓住它,改变它时,它散发出来的数据库。我怎样才能CSHARP到captialize...

所以基本上,如果我想从

so basically if i want to transform a name from

stephen smith 

Stephen Smith

我可以很容易地做到这一点与CSS来在页面上,但最好我想在前面抓住它,改变它时,它散发出来的数据库。我怎样才能CSHARP到captialize字符串。

i can easily do it with come css on the page but ideally I would like to catch it earlier on and change it when it comes out of the database. how can i get csharp to captialize a string.

有一个功能呢?

推荐答案

您可以使用的 System.Globalization.TextInfo 类:

You can do this using the ToTitleCase method of the System.Globalization.TextInfo class:

CultureInfo cultureInfo   = Thread.CurrentThread.CurrentCulture;
TextInfo textInfo = cultureInfo.TextInfo;

Console.WriteLine(textInfo.ToTitleCase(title));
Console.WriteLine(textInfo.ToLower(title));
Console.WriteLine(textInfo.ToUpper(title));
阅读全文

相关推荐

最新文章