Ray Yates
: rayyates at, pdqcoders d0t com
04/16/2018 09:58 a.m.
04/16/2018 09:58 a.m.
If you are looking for a way to convert a decimal number to hexadecimal, the function below will do that. There is a limit to the size of the input number.
<MvFUNCTIONNAME="dec2hex"PARAMETERS="num"STANDARDOUTPUTLEVEL=""><MvWHILEEXPR="{ l.num GT 0 }>"<MvASSIGNNAME="l.temp"VALUE="{ l.num mod 16 }>"<MvIFEXPR="{ l.temp LT 10 }>"<MvASSIGNNAME="l.ndx"VALUE="{ miva_array_insert( l.array, l.temp + 48, -1 ) }>"<MvELSE><MvASSIGNNAME="l.ndx"VALUE="{ miva_array_insert( l.array, l.temp + 55, -1 ) }>"</MvIF><MvASSIGNNAME="l.num"VALUE="{ (l.num - l.temp ) / 16 }>"</MvWHILE><MvASSIGNNAME="l.count"VALUE="{ miva_array_elements(l.array) }>"<MvFORFIRST="{ 1 }"LAST="{ l.count }>"<MvASSIGNNAME="l.return"VALUE="{ l.return $ asciichar(miva_array_pop( l.array )) }>"</MvFOR><MvFUNCTIONRETURNVALUE="{ l.return }>"</MvFUNCTION>