C# Uri IsHexDigit

Description

Uri IsHexDigit determines whether a specified character is a valid hexadecimal digit.

Syntax

Uri.IsHexDigit has the following syntax.


public static bool IsHexDigit(
  char character
)

Parameters

Uri.IsHexDigit has the following parameters.

  • character - The character to validate.

Returns

Uri.IsHexDigit method returns A Boolean value that is true if the character is a valid hexadecimal digit; otherwise false.

Example

The following example determines whether a character is a hexadecimal character and, if it is, writes the corresponding decimal value to the console.


/* www.  ja  v a2s. c  om*/
using System;
public class MainClass{
  public static void Main(String[] argv){  
    char  testChar = 'e';
    if (Uri.IsHexDigit(testChar) == true)
        Console.WriteLine("'{0}' is the hexadecimal representation of {1}", testChar, Uri.FromHex(testChar));
    else 
        Console.WriteLine("'{0}' is not a hexadecimal character", testChar);

  }
}
    

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version