Home » C#

C# | Uri.IsHexEncoding() Method with Example

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

Uri.IsHexEncoding() Method

Uri.IsHexEncoding() method is a static method or Uri class. Which is used to return that given string is hex-encoded or not? If the given string is hex coded then it returns true otherwise it returns false.

Syntax:

    bool Uri.IsHexEncoding(string str, int index);

Parameter(s):

  • string str – represents the string to be checked for hex encoding.
  • int index – represents the index for given string.

Return value:

The return type of this method is boolean, it returns true if given string is hex-encoded otherwise returns false.

Example to demonstrate example of Uri.IsHexEncoding() method

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        string str1 = "%75";
        string str2 = "75";

        if (Uri.IsHexEncoding(str1, 0))
            Console.WriteLine("Given string is hex-encoded");
        else
            Console.WriteLine("Given string is not hex-encoded");

        if (Uri.IsHexEncoding(str2, 0))
            Console.WriteLine("Given string is hex-encoded");
        else
            Console.WriteLine("Given string is not hex-encoded");
    }
}

Output

Given string is hex-encoded
Given string is not hex-encoded





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.