現在のカルチャの大文字と小文字の規則を使用して、この String のコピーを小文字で返します。
Overloads Public Function ToLower() As String
[C#]
public string ToLower();
[C++]
public: String* ToLower();
[JScript]
public function ToLower() : String;
戻り値
小文字の String 。
解説
このメソッドでは、現在のカルチャが考慮されます。詳細については、「 CultureInfo 」のトピックを参照してください。
使用例
[Visual Basic, C#, C++] 大文字と小文字が混在した複数の文字列を小文字に変換する例を次に示します。
Imports System
Public Class ToLowerTest
Public Shared Sub Main()
Dim info As String() = {"Name", "Title", "Age", "Location", "Gender"}
Console.WriteLine("The initial values in the array are:")
Dim s As String
For Each s In info
Console.WriteLine(s)
Next s
Console.WriteLine("{0}The lowercase of these values is:", Environment.NewLine)
For Each s In info
Console.WriteLine(s.ToLower())
Next s
Console.WriteLine("{0}The uppercase of these values is:", Environment.NewLine)
For Each s In info
Console.WriteLine(s.ToUpper())
Next s
End Sub 'Main
End Class 'ToLowerTest
[C#]
using System;
public class ToLowerTest {
public static void Main() {
string [] info = {"Name", "Title", "Age", "Location", "Gender"};
Console.WriteLine("The initial values in the array are:");
foreach (string s in info)
Console.WriteLine(s);
Console.WriteLine("{0}The lowercase of these values is:", Environment.NewLine);
foreach (string s in info)
Console.WriteLine(s.ToLower());
Console.WriteLine("{0}The uppercase of these values is:", Environment.NewLine);
foreach (string s in info)
Console.WriteLine(s.ToUpper());
}
}
[C++]
#using <mscorlib.dll>
using namespace System;
using namespace System::Collections;
int main()
{
String* info[] = {S"Name", S"Title", S"Age", S"Location", S"Gender"};
Console::WriteLine(S"The initial values in the array are:");
IEnumerator* myEnum = info->GetEnumerator();
while (myEnum->MoveNext()) {
String* s = __try_cast<String*>(myEnum->Current);
Console::WriteLine(s);
}
Console::WriteLine(S" {0}The lowercase of these values is:", Environment::NewLine);
IEnumerator* myEnum1 = info->GetEnumerator();
while (myEnum1->MoveNext()) {
String* s = __try_cast<String*>(myEnum1->Current);
Console::WriteLine(s->ToLower());
}
Console::WriteLine(S" {0}The uppercase of these values is:", Environment::NewLine);
IEnumerator* myEnum2 = info->GetEnumerator();
while (myEnum2->MoveNext()) {
String* s = __try_cast<String*>(myEnum2->Current);
Console::WriteLine(s->ToUpper());
}
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン
をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard
参照
String クラス | String メンバ | System 名前空間 | String.ToLower オーバーロードの一覧 | ToUpper