Re: getting real numbers from string expressions
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