Re: Manipulating text
Re: Manipulating text
- Subject: Re: Manipulating text
- From: Jon Pugh <email@hidden>
- Date: Fri, 25 Sep 2009 23:45:46 -0700
At 9:17 PM -0400 9/25/09, Mark J. Reed wrote:
>0x20ac in decimal
Dudes, this is an AppleScript list:
on fromHex(hStr)
copy "0123456789ABCDEF" to hConst
copy 0 to dVal
copy (length of hStr) to cCnt
repeat with i from cCnt to 1 by -1
set hVal to (offset of (character i of hStr) in hConst)
set newVal to (hVal - 1) * (16 ^ (cCnt - i)) as integer
set dVal to (dVal + newVal) as integer
end repeat
return dVal
end fromHex
on toHex(dStr)
copy dStr as number to dNum
copy "0123456789ABCDEF" to hConst
copy "" to hStr
repeat while dNum > 0
copy dNum mod 16 to thisHexNum
copy character (thisHexNum + 1) of hConst to thisHexChar
copy thisHexChar & hStr to hStr
copy dNum div 16 to dNum
end repeat
return hStr
end toHex
fromHex("20ac") -- ;)
Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden