如何使用 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