ToLower Method (String)
Collapse the table of content
Expand the table of content

TextInfo.ToLower Method (String)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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 sections of the Unicode standard that deal with case and case algorithms at the Unicode Web site. 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 CultureInfo.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 "en-US" culture.


Imports System.Globalization

Public Class Example
   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      ' 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").TextInfo

      ' Changes a string to lowercase.
      outputBlock.Text += String.Format("""{0}"" to lowercase: {1}", myString, myTI.ToLower(myString)) & vbCrLf

      ' Changes a string to uppercase.
      outputBlock.Text += String.Format("""{0}"" to uppercase: {1}", myString, myTI.ToUpper(myString)) & vbCrLf
   End Sub 
End Class 
' This example produces the following output.
'       "wAr aNd pEaCe" to lowercase: war and peace
'       "wAr aNd pEaCe" to uppercase: WAR AND PEACE


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft