Essential C# Common String Operations  Suggest an edit

Changing the case of characters within a String

The System.String class supports a number of methods to convert between uppercase and lowercase characters in a string.

Note: The reason to use the invariant versions of these methods is to prevent producing unexpected culture-specific letters. This is explained here in detail.


string s = "My String";
s = s.ToLowerInvariant(); // "my string"
s = s.ToUpperInvariant(); // "MY STRING"

Note that you can choose to specify a specific Culture when converting to lowercase and uppercase by using the String.ToLower(CultureInfo) and String.ToUpper(CultureInfo) methods accordingly.

Table Of Contents
11 Common String Operations
22 Enum
107 Stream
108 Timers
  ↑ ↓ to navigate     ↵ to select     Esc to close