byte.toString("X") always return 2 characters

  • Thread starter Thread starter Geoffrey
  • Start date Start date
G

Geoffrey

Hello,

with byte.toString("X"), if the decimal value of the byte is <16, then that
return opnly one character.
Is it possible (with a short things like another formatprovider than "X") to
always have the result on 2 characters, with the first 0 in this case

Thx
 
ToString("0X")

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
Geoffrey wrote:

with byte.toString("X"), if the decimal value of the byte is <16, then that
return opnly one character.
Is it possible (with a short things like another formatprovider than "X") to
always have the result on 2 characters, with the first 0 in this case

byte.ToString("X2")
is probably what you are looking for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top