Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

String::ToLower Method

Returns a copy of this string converted to lowercase.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public:
String^ ToLower()

Return Value

Type: System::String
A string in lowercase.

This method takes into account the casing rules of the current culture.

NoteNote

This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase.

Security Considerations

The casing operation that results from calling the ToLower() method takes the casing conventions of the current culture into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the ToLowerInvariant or ToUpperInvariant methods. This produces the same result in every culture (unlike the ToLower() method) and performs more efficiently.

Notes to Callers

As explained in Best Practices for Using Strings in the .NET Framework, we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, call the ToLower(CultureInfo) method overload with a value of CultureInfo::CurrentCulture for its culture parameter.

The following example converts several mixed case strings to lowercase.

using namespace System;
using namespace System::Collections;
int main()
{
   array<String^>^info = {"Name","Title","Age","Location","Gender"};
   Console::WriteLine( "The initial values in the array are:" );
   IEnumerator^ myEnum = info->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      String^ s = safe_cast<String^>(myEnum->Current);
      Console::WriteLine( s );
   }

   Console::WriteLine( " {0}The lowercase of these values is:", Environment::NewLine );
   IEnumerator^ myEnum1 = info->GetEnumerator();
   while ( myEnum1->MoveNext() )
   {
      String^ s = safe_cast<String^>(myEnum1->Current);
      Console::WriteLine( s->ToLower() );
   }

   Console::WriteLine( " {0}The uppercase of these values is:", Environment::NewLine );
   IEnumerator^ myEnum2 = info->GetEnumerator();
   while ( myEnum2->MoveNext() )
   {
      String^ s = safe_cast<String^>(myEnum2->Current);
      Console::WriteLine( s->ToUpper() );
   }
}
// The example displays the following output: 
//       The initial values in the array are: 
//       Name 
//       Title 
//       Age 
//       Location 
//       Gender 
//        
//       The lowercase of these values is: 
//       name 
//       title 
//       age 
//       location 
//       gender 
//        
//       The uppercase of these values is: 
//       NAME 
//       TITLE 
//       AGE 
//       LOCATION 
//       GENDER

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft