• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Manipulating text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Manipulating text (From: Jim Brandt <email@hidden>)
 >Re: Manipulating text (From: Luther Fuller <email@hidden>)
 >Re: Manipulating text (From: Philip Aker <email@hidden>)
 >Re: Manipulating text (From: Luther Fuller <email@hidden>)
 >Re: Manipulating text (From: "Mark J. Reed" <email@hidden>)
 >Re: Manipulating text (From: Philip Aker <email@hidden>)
 >Re: Manipulating text (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Manipulating text
  • Next by Date: Re: Manipulating text
  • Previous by thread: Re: Manipulating text
  • Next by thread: Re: Manipulating text
  • Index(es):
    • Date
    • Thread