i don't understand why the program throw exception?
this method need to convert haxdecimal to simple string without 0x
this method need to convert haxdecimal to simple string without 0x
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace hexdecimal
{
class Program
{
static void Main(string[] args)
{
string cleanInput;
Console.WriteLine("insert hexdecimal number");
string hd = Console.ReadLine();
cleanInput = GetHexStringWithout0x(hd);
Console.WriteLine("the values is {0}",cleanInput);
}
private static string GetHexStringWithout0x(string input)
{
string answer;
char[] hn = new char[input.Length];
hn = input.ToCharArray(2, input.Length);
answer = new string(hn);
return answer;
}
}
}
Comment