Home » C#

C# | Uri.HexUnescape() Method with Example

Uri.HexUnescape() Method: Here, we are going to learn about the HexUnescape() method of Uri class with example in C#.
Submitted by Nidhi, on March 26, 2020

Uri.HexUnescape() Method

Uri.HexUnescape() method is a static method that is used to convert the hexadecimal representation of a character to the character.

Syntax:

    char Uri.HexUnescape (string str, ref int index);

Parameter(s):

  • string str – represents the hexadecimal string.
  • ref int index – represents a ref variable for index.

Return value:

The return type of this method is char, it returns the character value of the specified character from the given hexadecimal string.

Exception:

    System.ArgumentOutOfRangeException;

Example to demonstrate example of Uri.HexUnescape() method

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        string str     = "%44";
        char retChar;
        int index      =    0;


        retChar = Uri.HexUnescape(str,ref index);
        
        Console.WriteLine("Hexadecimal character: "+retChar);
    }
}

Output

Hexadecimal character: D
Press any key to continue . . .


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.