I have a string of Hex numbers as, say
"010104000202000AC80627061202"
I want my output as
"01 01 04 00 02 02 00 0A C8 06 27 06 12 02"
I can use a for loop but is there any optimized way?
What I am doing currently is:
int length = line.Length/2; // Store the length of String
string outputstr = String.Empty;
for (int count = 0; count < length; count++)
{
outputstr += line.Substring(0, 2) + " "; //Get First two bytes and add space
line = line.Substring(2); // Remove those two bytes
}
StringBuilder