Register  ::  Login

February 06, 2012

Forums
 
Subject: Hexadecimal strings
Prev Next

Author Messages
DonUser is Offline
New Member
New Member
Posts:20


01/30/2005 5:24 PM Quote Reply  

From Borland non-tech forum, ozbear wrote:

Q: How do I get the hexadecimal string representation of an integer?
A1: s = String.Format('{0:X8}',yourint); // upper case hex
A2: s = String.Format('{0:x8}',yourint); // lower case hex

Q: How do I get the hexadecimal string representation of an character?
A1: s = String.Format('{0:X4}',(int)yourchar); // upper case hex
A2: s = String.Format('{0:x4}',(int)yourchar); // lower case hex

In the integer example, yourInt.ToString('X8') is another option.



Quick Reply
Username:  
Subject:  
Body: