How to convert from Hexadecimal value into C# String value

In this article we will discuss about how to convert from hexadecimal value into String value in C#.
  • 7723

In this article we are discussing about how to convert the Hexadecimal value into string value.  To do this first we will use split method of the String class and store the individual hexadecimal value in the string type array so that each value corresponds to a string and after that we will convert the Hexadecimal value to a decimal value using ToInt32() method of C#.

Lets have a look on the following example:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace ConsoleApplication15

{

    class Program

    {

        static void Main(string[] args)

        {

            string hexavalues = "47 6F 6F 64 20 4D 6F 72 6E 69 6E 67 21";

            string[] strsplit = hexavalues.Split(' ');

            foreach (String hexa in strsplit)

            {

                int values = Convert.ToInt32(hexa, 16);

                string strvalue = Char.ConvertFromUtf32(values);

                char character = (char)values;

                Console.WriteLine("hexadecimal value = {0}, int value = {1}, char value = {2} or {3}",

                                      hexa, values, strvalue, character);

            }

            Console.ReadLine();

        }

    }

}

Output:

 Image23.jpg

Further Readings
 
You may also want to read these related articles.
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.