INT转换为十六进制,然后到00 00 00 00的格式 [英] Convert int to hex and then into a format of 00 00 00 00
本文介绍了INT转换为十六进制,然后到00 00 00 00的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个整数,就会增
然后我想这个十六进制的,所以我做了转换,像这样: myInt.ToString(X);
I then want this in hex so I do the conversion like so: myInt.ToString("X");
然后我需要一个字符串中的00 00 00 00的格式,但我不能制定出一个办法十六进制字符串我现在转换成这种格式。
I then need a string in the format of 00 00 00 00 but I cannot work out a way to convert the hex string I now have into this format.
推荐答案
通过LINQ查询,你可以这样做:
With a Linq query you can do this:
string.Join(" ", BitConverter.GetBytes(myInt).Select(x=>x.ToString("x")).ToArray());
这篇关于INT转换为十六进制,然后到00 00 00 00的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文