> Integer values?
I hope so.
> >Does anyone out there have a function to convert a decimal string to its
> equivalent hex value? I am not a math major (or minor <grin>) and don't
> look forward to figuring one out myself.
I haven't tried this code, so no guarantees, but give it a shot:
procedure Dec2Hex
parameter lnInput
* Setting this up as a Procedure means that the parameter
* is passed by reference. Since we will be making changes
* to it, make a copy. While we're at it, drop the decimal.
m.lnInteger = floor(m.lnInput)
* Initialize the output
m.lcOutput = ""
do while m.lnInteger > 0
* Determine the Lease Significant Nybble (LSN? <g>)
m.lnValue = mod(m.lnInteger,16)
* Add the nybble value to the output
m.lcOutput = substr("0123456789ABCDEF",m.lnValue+1,1)+m.lcOutput
* Adjust the original value
m.lnInteger = (m.lnInteger - m.lnValue) / 16
enddo
* If this is an uneven length, then add an "0" on the left
* This may have happened because we worked with a nybble
* at a time, not a byte at a time
if len(m.lcOutput)/2 # int(len(m.lcOutput)/2)
m.lcOutput = "0" + m.lcOutput
endif
return m.lcOutput