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
The Unicode character to convert.
ReturnsThe uppercase equivalent of c
, or the unchanged value of c
if c
is already uppercase, has no uppercase equivalent, or is not alphabetic.
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 CallersAs 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.
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