Re: How to construct a string with bunch of hex numbers?



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)...

.



Relevant Pages

  • injection_projection code
    ... because of hex encoding. ... a row in the template. ... Sanitize string to protect against email header injection. ... void injection_protection(char *s) ...
    (freebsd-isp)
  • Re: PCL images and mvEnterprise
    ... decimal then CHAR to get the Ascii character. ... to print the letter "A" {'A' is hex 41}, ... or by instead sending the equivalent hex pairs string ...
    (comp.databases.pick)
  • Re: healp reading / writing binary strings.
    ... Robert Klemme wrote: ... > And how can I write the same type of string from say an ... to the ascii table as well? ... for hex, does the hex value I supply correspond to the ascii table as ...
    (comp.lang.ruby)
  • Re: Attn:Mark Space... My Ascii 2 Hex back 2 Ascii program.
    ... converts it to it's Hex value and then converts the Hex value ... back to the Ascii string value. ... // system.in reader (the input from console) ...
    (comp.lang.java.help)
  • Attn:Mark Space... My Ascii 2 Hex back 2 Ascii program.
    ... It takes console input of an ascii ... converts it to it's Hex value and then converts the Hex value ... back to the Ascii string value. ...
    (comp.lang.java.help)