Re: Accessing a Record by variable--the solutions
Re: Accessing a Record by variable--the solutions
- Subject: Re: Accessing a Record by variable--the solutions
- From: "Arthur J Knapp" <email@hidden>
- Date: Thu, 15 Feb 2001 12:52:31 -0500
>
Subject: Re: Accessing a Record by variable--the solutions
>
Date: Wed, 14 Feb 2001 21:38:25 +0000
>
From: Nigel Garvey <email@hidden>
>
>1 Can one make any useful generalizations about the solutions
>
Arthur's has my vote (without testing, that is). It uses a single string
>
instead of a list (memory) and doesn't need a repeat (time). It could be
>
simplied a little:
>
>
property kStrMonths : "DumJanFebMarAprMayJunJulAugSepOctNovDec"
Darn, I know this trick too. :)
>
on monthIndex(mon) -- Note, mon must be case-sensitive
>
return (offset of mon in kStrMonths) div 3
>
end monthIndex
>
>
set theMonth to "Feb"
>
monthIndex(theMonth)
>
>
... and (for form's sake) kStrMonths would ideally be set as a local
>
variable within the handler.
Now, who can modify this basic technique just enough to work with
the slightly less case-sensitive string:
property kStrMonths :
"...JanjanFebfebMarmarApraprMaymayJunjunJuljulAugaugSepsepOctoctNovnovDecdec
"
or something like it?
>
By the way, Arthur, does the 'k' stand for 'kNapp'?
I am just a scripter trying to get by in a programmer's world. ;-)
--
{
Arthur J Knapp, of STELLARViSIONs ;
http://www.STELLARViSIONs.com ;
mailto:email@hidden ;
how many?
zero.
are you sure?
i counted twice.
}