Re: How to construct a string with bunch of hex numbers?
- From: Doug Semler <dougsemler@xxxxxxxxx>
- Date: Tue, 11 Sep 2007 14:31:06 -0700
On Sep 11, 5:12 pm, dh <d...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"Doug Semler" wrote:
On Sep 11, 4:14 pm, dh <d...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
If there's bunch of hex numbers: 0xA6, 0xD9, 0x00, 0xAA, 0x00, and 0x62, how
to construct a string ("string" in C#) with those hex numbers?
What do you mean by "a bunch of hex numbers?" Do you mean an array of
bytes? if so:
string s = BitConverter.ToString(byteArray);
would give you a string that looked like "A6-D9-00-AA-00-62"
No. I'd like to have a string like "xyzabc" and each ASCII char corresponds
to a hex number.
Please define "bunch of hex numbers." How are they being stored?
Array of bytes? Array of chars? in an array of doubles? Are the "hex"
digits only going to be ASCII or are they Unicode characters? From
your numbers above, you aren't representing an ASCII string anyway so
then you have to start getting into Char conversions and how to do
that properly.
There are a few overloads of the String() class that take in an array
of Char or a pointer to sbyte (last one must be null terminated and is
only used in unsafe code)...
.
- References:
- Re: How to construct a string with bunch of hex numbers?
- From: Doug Semler
- Re: How to construct a string with bunch of hex numbers?
- Prev by Date: Re: Windows Service Dies on Exception
- Next by Date: Re: Windows Service Dies on Exception
- Previous by thread: Re: How to construct a string with bunch of hex numbers?
- Next by thread: Re: How to construct a string with bunch of hex numbers?
- Index(es):
Relevant Pages
|