A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/api/system.char.toupper below:

Char.ToUpper Method (System) | Microsoft Learn

Source:
Char.cs
Source:
Char.cs
Source:
Char.cs
Source:
Char.cs

Converts the value of a Unicode character to its uppercase equivalent.

public:
 static char ToUpper(char c);
public static char ToUpper(char c);
static member ToUpper : char -> char
Public Shared Function ToUpper (c As Char) As Char
Parameters
c
Char

The Unicode character to convert.

Returns

The uppercase equivalent of c, or the unchanged value of c if c is already uppercase, has no uppercase equivalent, or is not alphabetic.

Examples

The following example converts each character in an array to its uppercase equivalent.

using System;

public class Example
{
   public static void Main()
   {
      char[] chars = { 'e', 'E', '6', ',', 'ж', 'ä' };
      foreach (var ch in chars)
          Console.WriteLine("{0} --> {1} {2}", ch, Char.ToUpper(ch),
                            ch == Char.ToUpper(ch) ? "(Same Character)" : "" );
   }
}
// The example displays the following output:
//       e --> E
//       E --> E (Same Character)
//       6 --> 6 (Same Character)
//       , --> , (Same Character)
//       ж --> Ж
//       ä --> Ä
open System

let chars = [| 'e'; 'E'; '6'; ','; 'ж'; 'ä' |]

for ch in chars do
    printfn $"""{ch} --> {Char.ToUpper ch} {if ch = Char.ToUpper ch then "(Same Character)" else ""}"""

// The example displays the following output:
//       e --> E
//       E --> E (Same Character)
//       6 --> 6 (Same Character)
//       , --> , (Same Character)
//       ж --> Ж
//       ä --> Ä
Module Example
   Public Sub Main()
      Dim chars() As Char = { "e"c, "E"c, "6"c, ","c, "ж"c, "ä"c }
      For Each ch In chars
         Console.WriteLine("{0} --> {1} {2}", ch, Char.ToUpper(ch),
                           If(ch = Char.ToUpper(ch), "(Same Character)", ""))
      Next
   End Sub
End Module
' The example displays the following output:
'       e --> E
'       E --> E (Same Character)
'       6 --> 6 (Same Character)
'       , --> , (Same Character)
'       ж --> Ж
'       ä --> Ä
Remarks

Casing rules are obtained from the current culture.

Use String.ToUpper to convert a string to uppercase.

Notes to Callers

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

See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4