
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Uri.IsHexEncoding() Method in C#
The Uri.IsHexEncoding() method in C# determines whether a character in a string is hexadecimal encoded.
Syntax
Following is the syntax −
public static bool IsHexEncoding (string pattern, int index);
Above, the pattern parameter is the string to check, whereas the index is the location in pattern to check for hexadecimal encoding.
Example
Let us now see an example to implement the Uri.IsHexEncoding() method −
using System; public class Demo { public static void Main(){ string pattern = "%50"; bool res = Uri.IsHexEncoding(pattern, 0); if (res) Console.WriteLine("Valid: Hexadecimal Encoded"); else Console.WriteLine("Invalid: Hexadecimal Encoded"); } }
Output
This will produce the following output −
Valid: Hexadecimal Encoded
Example
Let us now see another example to implement the Uri.IsHexEncoding() method:
using System; public class Demo { public static void Main(){ string pattern = "%60"; bool res = Uri.IsHexEncoding(pattern, 1); if (res) Console.WriteLine("Valid: Hexadecimal Encoded"); else Console.WriteLine("Invalid: Hexadecimal Encoded"); } }
Output
This will produce the following output −
Invalid: Hexadecimal Encoded
Advertisements