如何使用 C# 将大写转换成小写?


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

假设你的字符串为 -

str = "TIM";

要将上述大写字符串转换为小写,请使用 ToLower() 方法 -

Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());

以下是 C# 中用于转换字符大小写的代码 -

示例

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();
      }
   }
}

更新日期:21-6-2020

2K+ 浏览量

启动您的 职业

通过完成课程获得认证

开始
广告
© . All rights reserved.