Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

TextInfo.ToLower Method (String)

Converts the specified string to lowercase.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
'Declaration
Public Overridable Function ToLower ( _
	str As String _
) As String

Parameters

str
Type: System.String

The string to convert to lowercase.

Return Value

Type: System.String
The specified string converted to lowercase.
ExceptionCondition
ArgumentNullException

str is null.

The returned string might differ in length from the input string. For more information on casing, refer to the Unicode Technical Report #21 "Case Mappings," published by the Unicode Consortium (http://www.unicode.org). The current implementation preserves the length of the string. However, this behavior is not guaranteed and could change in future implementations.

Casing semantics depend on the culture in use. For the invariant culture, the casing semantics are not culture-sensitive. For a specific culture, the casing semantics are sensitive to that culture.

If a security decision depends on a string comparison or a case-change operation, the application should use the InvariantCulture to ensure that the behavior is consistent regardless of the culture settings of the system. However, the invariant culture must be used only by processes that require culture-independent results, such as system services. Otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

For more information on cultures, see CultureInfo.

The following code example changes the casing of a string based on the English (United States) culture, with the culture name en-US.

Imports System
Imports System.Globalization

Public Class SamplesTextInfo

   Public Shared Sub Main()

      ' Defines the string with mixed casing. 
      Dim myString As String = "wAr aNd pEaCe" 

      ' Creates a TextInfo based on the "en-US" culture. 
      Dim myTI As TextInfo = New CultureInfo("en-US", False).TextInfo

      ' Changes a string to lowercase.
      Console.WriteLine("""{0}"" to lowercase: {1}", myString, myTI.ToLower(myString))

      ' Changes a string to uppercase.
      Console.WriteLine("""{0}"" to uppercase: {1}", myString, myTI.ToUpper(myString))

      ' Changes a string to titlecase.
      Console.WriteLine("""{0}"" to titlecase: {1}", myString, myTI.ToTitleCase(myString))

   End Sub 'Main 

End Class 'SamplesTextInfo


'This code produces the following output. 

'"wAr aNd pEaCe" to lowercase: war and peace 
'"wAr aNd pEaCe" to uppercase: WAR AND PEACE 
'"wAr aNd pEaCe" to titlecase: War And Peace

.NET Framework

Supported in: 4.5.1, 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 8, Silverlight 8.1

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.