C# Char ToUpper(Char)
Description
Char ToUpper(Char)
converts the value of a Unicode character
to its uppercase equivalent.
Syntax
Char.ToUpper(Char)
has the following syntax.
public static char ToUpper(
char c
)
Parameters
Char.ToUpper(Char)
has the following parameters.
c
- The Unicode character to convert.
Returns
Char.ToUpper(Char)
method 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.
Example
The following example converts each character in an array to its uppercase equivalent.
// www . ja v a2 s.co m
using System;
public class Example
{
public static void Main()
{
char[] chars = { 'a', 'E', '6' };
foreach (var ch in chars)
Console.WriteLine("{0} --> {1} {2}", ch, Char.ToUpper(ch),
ch == Char.ToUpper(ch) ? "(Same Character)" : "" );
}
}
The code above generates the following result.