[progress Communities] [progress Openedge Abl] Forum Post: Re: Integer To Hex

  • Thread starter Thread starter Pieterm
  • Start date Start date
Status
Not open for further replies.
P

Pieterm

Guest
Richard, The code returns the HEX backwards, or the issue is rather that for hex the value has to be build up from the last to first remainders. Just by change I needed the same thing yesterday and after investigation the formula, I wrote the snippet below. It is basic but it works. DEF VAR iInt AS INTE. DEF VAR cHex AS CHAR. DEF VAR iMod AS INTE. ASSIGN iInt = 7722. REPEAT: iMod = iInt MODULO 16. IF iMod = 0 THEN LEAVE. cHex = ENTRY(iMod,"1,2,3,4,5,6,7,8,9,A,B,C,D,E,F",",") + cHex. iInt = INTEGER(ENTRY(1,STRING(iInt / 16),".")). END. MESSAGE cHex VIEW-AS ALERT-BOX INFO BUTTONS OK.

Continue reading...
 
Status
Not open for further replies.
Back
Top