From: WatsonR@IntelligenCIA.com   
      
   Antony Clements wrote:   
   > "Raoul Watson" wrote in message   
   > news:IcNzl.387$Q52.377@nwrddc02.gnilink.net...   
   >> Antony Clements wrote:   
   >>> I have a hex string consisting of 64 characters, and I want to take every   
   >>> two characters and convert them to their respective byte value (eg FF =   
   >>> 255). Is there a fast and eficient way of doing this, or does it have to   
   >>> be done manually?   
   >> I would use the VB internal ability to convert hex:   
   >>   
   >> Private Function Hex2Dec(h$) As Integer   
   >> h$ = "&H" & h$   
   >> Hex2Dec = Val(h$)   
   >> End Function   
   >>   
   >> So you'll get 255 when you pass "FF"   
   >   
   > Thanks, I didn't know there was an internal function. This would work fine   
   > for integers, but what if the value is only a single byte, or a long, or a   
   > double? Would this also work for turning a value into a hex value?   
   >   
   > In another part of my code I am taking a integral double (no decimal points)   
   > and converting it to hex, manipulating the hex value and converting it back,   
   > it's all very resource consuming.   
   >   
   >   
   Use the HEX function to go the other way. Byte, long, doesn't matter. Do   
   it it a byte at a time..   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|