如何使用 C# 将大写字母转换为小写字母?
csharpprogrammingserver side programming更新于 2025/5/28 18:07:17
要将大写字母转换为小写字母,请使用 C# 中的 ToLower() 方法。
假设您的字符串为 −
str = "TIM";
要将上述大写字母字符串转换为小写字母,请使用 ToLower() 方法 −
Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());
以下是 C# 中将字符大小写转换为的代码 −
示例
using System;
using System.Collections.Generic;
using System.Text;
命名空间演示 {
class MyApplication {
static void Main(string[] args) {
string str;
str = "TIM";
Console.WriteLine("UpperCase : {0}", str);
// 转换为小写
Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());
Console.ReadLine();
}
}
}

