• 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: getting real numbers from string expressions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting real numbers from string expressions


  • Subject: Re: getting real numbers from string expressions
  • From: Ehsan Saffari <email@hidden>
  • Date: Fri, 25 May 2001 02:26:41 -0600

On 24/05/2001 21:43, "Romulus Barabas" <email@hidden> wrote:

>I'm working on a script that extracts data from FileMaker and operates on a
>Quark file. The data is in string format, but indicates a measurement, like
>"7 7/8" or "7-7/8" (meaning 7 + 7 / 8). The expression (7 + 7 / 8) evaluates
>fine as a real number when I type it directly in the script but I don't know
>how to evaluate it when it comes as a string variable (after changing - to
>+).

here's one way..

set t to "25-9/16"
set m to offset of "/" in t
set h to offset of "-" in t
set j to text (m + 1) thru - 1 of t
set i to text 1 thru (h - 1) of t
set k to text (h + 1) thru (m - 1) of t
set n to i + (k / j) --> 25.5625

cheers
ehsan


  • Prev by Date: Re: Minimizing current app
  • Next by Date: Re: Outlook Express rules?
  • Previous by thread: getting real numbers from string expressions
  • Next by thread: Re:getting real numbers from string expressions
  • Index(es):
    • Date
    • Thread