string str = "perschon c# tutorial"; str.ToUpper(); //Perschon C# TUTORIAL str.ToLower(); //perschon c# tutorial char c = 't'; c.ToString().ToUpper(); //T char c2 = 'T'; c2.ToString().ToLower(); //t
public static string UppercaseFirst(string s)
{
string str = "";
str += s[0].ToString().ToUpper();
str += s.Substring(1);
return str;
}
public static string UppercaseAllFirst(string s)
{
string str = "";
string[] arr = s.Split(' ');
if (arr.Length == 1)
{
str += s[0].ToString().ToUpper();
str += s.Substring(1);
}
else
{
foreach (string wd in arr)
{
str += wd[0].ToString().ToUpper();
str += wd.Substring(1) + " ";
}
str.TrimEnd();
}
return str;
}