Export (0) Print
Expand All

String.ToLowerInvariant Method

Returns a copy of this string converted to lowercase using the casing rules of the invariant culture.

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

'Declaration
Public Function ToLowerInvariant As String

Return Value

Type: System.String
The lowercase equivalent of the current string.

The invariant culture represents a culture that is culture-insensitive. It is associated with the English language but not with a specific country or region..

If your application depends on the case of a string changing in a predictable way that is unaffected by the current culture, use the ToLowerInvariant method. The ToLowerInvariant method is equivalent to ToLower(CultureInfo.InvariantCulture). The method is recommended when a collection of strings must appear in a predictable order in a user interface control.

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.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

This member is present to support the .NET Compact Framework infrastructure in Silverlight for Windows Phone, and it is not intended to be used in your application code.

The following example defines a string array that contains a single word in a number of languages. The ToLowerInvariant method is used to populate the elements of a parallel array with the case-insensitive version of each word. The Array.Sort(Of TKey, TValue)(TKey(), TValue(), IComparer(Of TKey)) method is used to sort the case-sensitive array based on the order of elements in the lowercase array to ensure that elements appear in the same order regardless of language.


Module Example
   Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      Dim words() As String = {"Tuesday", "Salı", "Вторник", "Mardi", _
                                "Τρίτη", "Martes", "יום שלישי", _
                                "الثلاثاء", "วันอังคาร"}
      ' Display array in unsorted order.
      For Each word As String In words
         outputBlock.Text &= word & vbCrLf
      Next
      outputBlock.Text &= vbCrLf

      ' Create parallel array of words by calling ToUpperInvariant.
      Dim upperWords(words.Length - 1) As String
      For ctr As Integer = words.GetLowerBound(0) To words.GetUpperBound(0)
         upperWords(ctr) = words(ctr).ToUpperInvariant()
      Next

      ' Sort the words array based on the order of upperWords.
      Array.Sort(upperWords, words, StringComparer.InvariantCulture)

      ' Display the sorted array.
      For Each word As String In words
         outputBlock.Text &= word & vbCrLf
      Next
   End Sub
End Module
' The example displays the following output:
'       Tuesday
'       Salı
'       Вторник
'       Mardi
'       Τρίτη
'       Martes
'       יום שלישי
'       الثلاثاء
'       วันอังคาร
'       
'       Mardi
'       Martes
'       Salı
'       Tuesday
'       Τρίτη
'       Вторник
'       יום שלישי
'       الثلاثاء
'       วันอังคาร


Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft