当前位置: 代码迷 >> 综合 >> 把字符串的所有字符转化为大写
  详细解决方案

把字符串的所有字符转化为大写

热度:67   发布时间:2024-01-17 03:39:46.0
using System;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string str = "Hello";
str.ToUpper();// 把字符串的所有字符转化为大写
Console.WriteLine(str);// Hello,证明字符串具有不可修改性
str = str.ToUpper();// 形成新的字符串,字符串变量指向新的字符串
Console.WriteLine(str);
Console.ReadKey();
}
}
}


  相关解决方案