ในการแปลงตัวพิมพ์ใหญ่เป็นตัวพิมพ์เล็ก ให้ใช้วิธี ToLower() ใน C#
สมมติว่าสตริงของคุณคือ −
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();
}
}
}