Prev: VO28.8 big annoyance
Next: Constant
From: Rob Smith on 17 Jan 2010 09:21 I have a field which was the AsHexString of another field. Sadly the original field has become corrupt, it there an opposite to AsHexString I can use to get it back again? Thanks Robert
From: Karl Faller on 17 Jan 2010 10:09 Rob, >I have a field which was the AsHexString of another field. Sadly the >original field has become corrupt, it there an opposite to AsHexString >I can use to get it back again? Wouldn't know of - but FUNC HexString2String(cHex AS STRING) AS STRING LOCAL cRes AS STRING LOCAL i, nVal AS INT IF SLen(cHex) < 3 FOR i := 1 UPTO SLen(cHex)-2 STEP 3 nVal := 16*Val(SubStr3(cHex,i,1))+Val(SubStr3(cHex,i+1,1)) ? cRes += CHR(nVal) NEXT ELSE cRes := "" ? Param invalid ENDIF RETURN cRes should do Karl
From: Stephen Quinn on 17 Jan 2010 10:40 Rob >I have a field which was the AsHexString of another field. Sadly the > original field has become corrupt, it there an opposite to AsHexString > I can use to get it back again? Hex2Bin() CYA Steve
From: Karl Faller on 17 Jan 2010 13:48 On Sun, 17 Jan 2010 15:40:19 GMT, "Stephen Quinn" <stevejqNO(a)bigpondSPAM.net.au> wrote: >Rob > >>I have a field which was the AsHexString of another field. Sadly the >> original field has become corrupt, it there an opposite to AsHexString >> I can use to get it back again? > >Hex2Bin() > my sdk has no such func. Karl
From: Karl Faller on 17 Jan 2010 15:43
>Hex2Bin() Hex2C() does it. But beware: feeded directly with the result of AsHexString() it produces garbage, as the blanks aren't removed... Karl |