Hi all
I'm working at a Function which transforms numbers in a another numbersystems (e.g 10(DEC) = A(hex))
My problem is to do it with that limited API.
Here my code
function DecToX(dec:integer;base:byte): String;
const
number=array[0..49] of char= // it does not accept definitions like that! delphi and others does
('0', '1', '2', '3', '4', '5', '6', '7','8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X', 'Y', 'Z', '+', '-', '<', '>',
'!', '{', '}', '%', '[', ']', '(', ')', '~', '*' );
begin
if (dec <> 0) and (base<=50) then
Result := decToX(dec div base ) + number[dec mod base]
else
Result := '';
end;
end;
my question now is:
Exist another possibility to do it, asides primitive declaring of an array and assign the values?
Date Posted: January 02, 2008, 10:46:59 am
Hi again
I would be Glad if someone response.
I'm sure that you thought about, what my purpose is, to change the Base of a Number...
I want to sent information over GETURL to a PHP-script which saves the DATA in a MYSQL-DATABASE.
I crypt-ed the information in a numeric value.
The problem is:
more information means more traffic.
So if i Commpress the Information, i decrease the using of GETURL.
The easiest method of decreasing the length of a number is changing the Base.
That allows to reduce the quantity of using GETURL with a factor of 2000.
But using of associative-arrays is in this API not possible...
I would be very thankful for response.