using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
//ToUpper方法可实现将英文转换成大写
string str = "a dota a day keeps girls away.";
Console.WriteLine("大写字符串:" + str.ToUpper());
Console.WriteLine("小写字符串:" + str.ToLower());
char word = 'a';
Console.WriteLine("大写字符:" + char.ToUpper(word));
Console.WriteLine("小写字符:" + char.ToLower(word));
Console.ReadKey();
}
}
}
注意string和char对于方法的引用格式不一样。
string: 变量名.方法名();
char:char.方法名(变量名);