[英]converting to uppercase in ascx.cs
I currently have the following code which transforms the first letter of the surname to uppercase; 我目前有以下代码,将姓氏的第一个字母转换为大写;
static string UppercaseFirst(string s)
{
if (string.IsNullOrEmpty(s))
{
return string.Empty;
}
char[] a = s.ToCharArray();
a[0] = char.ToUpper(a[0]);
return new string(a);
}
I now want to edit it so it changes all the letters in the surname to uppercase. 我现在要对其进行编辑,以便将姓氏中的所有字母都更改为大写。 Should be a simple one but my ascx.cs knowledge is dire!
应该很简单,但是我的ascx.cs知识真可怕! :) thanks
:) 谢谢
Try return s.ToUpper();
尝试
return s.ToUpper();
or a variant of, ToUpperInvariant()
, etc. 或
ToUpperInvariant()
等的变体。
There are a number of ways to do this to be 'culturally safe', depending on your requirements. 有多种方法可以做到“文化安全”,具体取决于您的要求。
try this 尝试这个
static string UppercaseFirst(string s)
{
return s.ToUpper();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.