• 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
What's the easy way to do this? (convert string to num without excess chars)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's the easy way to do this? (convert string to num without excess chars)


  • Subject: What's the easy way to do this? (convert string to num without excess chars)
  • From: email@hidden
  • Date: Thu, 27 Jun 2002 04:23:56 EDT

-- given string SomeCMMeasure = "1.0234 cm", then

set TheMeasure to ((characters 1 thru -4 of SomeCMMeasure as string) as
number)

-- this should result in trimming the last three characters of the string
-- and coerce it to a number

set TheMeasure to (TheMeasure + 1)

-- or whatever math you need to do

set SomeCMMeasure to ((TheMeasure as string) & " cm") as string

-- reconvert it to the expected string format.


Meanwhile, if Shane Stanley's solution works for your needs, it appears
cleaner (fewer steps too) and I'd recommend it.

=-= Marc

Date: Wed, 26 Jun 2002 13:42:44 +0100
Subject: What's the easy way to do this?
From: Steve <email@hidden>
[snip]

Is there a better way to achieve this? "1.234 cm" - " cm" = "1.234" than
checking each character?

Thanks,
Steve
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Scripting for dialogs oin OS X
  • Next by Date: Re: Scripting for dialogs oin OS X
  • Previous by thread: Re: Scripting for dialogs oin OS X
  • Next by thread: Problem with iTunes & AppleScript (1.8.3)
  • Index(es):
    • Date
    • Thread