たとえば、16進数の文字列があります
"010104000202000AC80627061202"
私は私の出力が欲しい
"01 01 04 00 02 02 00 0A C8 06 27 06 12 02"
for ループを使用できますが、最適化された方法はありますか?
私が現在行っていることは次のとおりです。
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
}