Converting Hex to binary
Converting Hex to binary
- Subject: Converting Hex to binary
- From: Bernardo Hoehl <email@hidden>
- Date: Sat, 8 Jan 2005 17:40:17 -0200
Hi List!
I know that I over work my scripts all the time.
But this is common to newbyes. Ins't it?
I have this script that aparently is functional:
set theInput to "0309"
set HexList to every character of ("0123456789ABCDEF")
set binList to {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"}
set ConvertedBin to ""
repeat with i from 1 to the count of theInput
repeat with ii from 1 to the count of HexList
if item i of theInput is item ii of HexList then
set ConvertedBin to ConvertedBin & item ii of binList
end if
end repeat
end repeat
return ConvertedBin --returns "0000001100001001"
Please:
Could you comment my script?
I bet you would write it in a shorter way.
thanks!
Bernardo Höhl
Rio de Janeiro - Brazil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden