如何使用 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();
}
}
}
广告
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP