| T O P I C R E V I E W |
| tib |
Posted - 06/16/2003 : 11:29:48 AM Is there an easy way in LabTalk to convert decimal numbers into hexadecimal or binary strings?
I want to run a loop from 0 to 255 but use the hexadecimal string for example to generate a name.
The only thing I found in the manual was the function HEX() which returns the decimal number. Why is there nothing for the other way round? And for binary numbers? Do I have to write my own function? Or does anybody already have such a script? Thanks, Tilman. |
| 1 L A T E S T R E P L I E S (Newest First) |
| greg |
Posted - 07/10/2003 : 5:22:33 PM You would need to write your own code for this. You can write an OriginC function for hex strings pretty easily:
string gethex(int iValue) { string str; str.Format("%X", iValue); return str; }
After building this you can use it in LabTalk:
%A = gethex(myintegervalue)$; %A =;
For example:
myval = 16770219; %A = gethex(myval); %A =;
would yield:
FFE4AB
|