110,536
社区成员
发帖
与我相关
我的任务
分享
StringBuilder sbcap = new StringBuilder("abcde");
sbcap[0] = sbcap[0].ToString().ToUpper()[0];
if (str.Length > 1)
{
str = str[0].ToString().ToUpper + str.Substring(1, str.Length - 1);
}
else
{
str = str.ToUpper();
}
string str = "renzhijie";
char a = str[0];
str = str.Remove(0, 1);
str= a.ToString().ToUpper()+str;
static void Main(string[] args)
{
string Capital = "abcd";
char Primacy = Convert.ToChar(Capital.Substring(0, 1));
if ((int)Primacy >= 97 && (int)Primacy <= 122)
{
Console.WriteLine(Primacy.ToString().ToUpper() + Capital.Substring(1));
}
Console.ReadKey();
}
string str = "hello";
MessageBox.Show(str.Substring(0, 1).ToUpper() + str.Substring(1));//Hello
string a = "dsfgsdfgsdgsdgsdg";
a=a.Substring(0, 1).ToUpper()+a.Substring(1);
System.Console.WriteLine(a);
class Program
{
static void Main(string[] args)
{
string aa = "%.,46,2xb1bfs.,,";
int pos = isLetter(aa);
aa = aa.Substring(pos, 1);
Console.WriteLine(aa.ToUpper());
Console.Read();
}
public static int isLetter(string validString)
{
byte[] tempbyte = System.Text.Encoding.Default.GetBytes(validString);
int pos = 0;
for (int i = 0; i < validString.Length; i++)
{
byte by = tempbyte[i];
if ((by >= 65) && (by <= 90) || ((by >= 97) && (by <= 122)))
{
break;
}
pos++;
}
return pos;
}
}
if (str.Length > 1)
{
str = str[0].ToString().ToUpper + str.Substring(1, str.Length - 1);
}
else
{
str = str.ToUpper();
}
String s = "abcdefg";
MessageBox.Show(s.Length > 0 ? Char.ToUpper(s[0]) + (s.Length > 1 ? s.Substring(1, s.Length - 1) : "") : "");
class Program
{
static void Main(string[] args)
{
string str = "hello world";
str = str.Substring(0,1).ToUpper()+str.Substring(1);
Console.Write(str);
Console.ReadLine();
}
}