PDA

View Full Version : Hex To Dec Converter



BERKANT74
03-25-2009, 08:09 PM
hello friends,
I would like a hex to dec converter create.
how can I input 1 Input.
1 Input to create output.
I input multiple output ok.
with 1 input does not work.
Please help me thank.

Deutsch /Germany :
hallo freunde,
ich möchte ein hex to dec converter erstellen.
wie kann ich 1 Input eingang,1 Input mit ausgang erstellen.
mir mehreren ausgang Input ok,mit 1 Input klappt nicht.
Bitte helfen Sie mir danke.

Very little do I enlisch


as the visual input with multiple output ok (My project1)
http://img53.imageshack.us/img53/4589/hextodec.th.jpg (http://img53.imageshack.us/my.php?image=hextodec.jpg)
http://img141.imageshack.us/img141/3918/hextodec1.th.jpg (http://img141.imageshack.us/my.php?image=hextodec1.jpg)
this image with 1 input not ( mit disesem bild mit ein ausgang klappt nicht. (My project2)
http://img141.imageshack.us/img141/3863/hextodec2.th.jpg (http://img141.imageshack.us/my.php?image=hextodec2.jpg)

Kick
03-26-2009, 10:42 AM
For My Project1.apz

On Click the button "Button2":


function HexToDec(strHex)
local tblResult = {};
local strHex = String.Replace(strHex, " ", "", false);
for i = 1, String.Length(strHex), 2 do
tblResult[Table.Count(tblResult) + 1] = Math.HexToNumber(String.Mid(strHex, i, 2));
end
if (Table.Count(tblResult) == 0) then return nil else return tblResult end
end



tblDec = HexToDec(String.Lower(Input.GetText("HexToDec")));
if (tblDec ~= nil) then
for i, v in tblDec do
Input.SetText("Dec_Out"..i, v);
end
end

For My Project2.apz

On Click the button "Button2":


function HexToDec(strHex)
local tblResult = {};
local strHex = String.Replace(strHex, " ", "", false);
for i = 1, String.Length(strHex), 2 do
tblResult[Table.Count(tblResult) + 1] = Math.HexToNumber(String.Mid(strHex, i, 2));
end
if (Table.Count(tblResult) == 0) then return nil else return tblResult end
end



tblDec = HexToDec(String.Lower(Input.GetText("HexToDec")));
if (tblDec ~= nil) then
local strOut = "";
for i, v in tblDec do
v = String.Repeat("0", 3 - String.Length(v))..v;
strOut = strOut.." "..v;
end
Input.SetText("Dec_Out1", strOut);
end

BERKANT74
03-26-2009, 06:20 PM
Hello "Kick"

What more can you ask for.
Simply perfect brilliantly.
Thank you very much for everything.