如何使用 C# 将大写字母转换为小写字母?

如何使用 C# 将大写字母转换为小写字母?

要将大写字母转换为小写字母,请使用 C# 中的 ToLower() 方法。

假设您的字符串是 -

str = "TIM";登录后复制

Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());登录后复制

示例

using System; using System.Collections.Generic; using System.Text; namespace Demo { class MyApplication { static void Main(string[] args) { string str; str = "TIM"; Console.WriteLine("UpperCase : {0}", str); // convert to lowercase Console.WriteLine("Converted to LowerCase : {0}", str.ToLower()); Console.ReadLine(); } } }登录后复制