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: Nigel Garvey <email@hidden>
- Date: Fri, 16 Feb 2001 09:46:07 +0000
"Arthur J Knapp" wrote on 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>
>
> 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?
property kStrMonths : "umanebarprayunulugepctovec"
on monthIndex(mon) -- Note, text 2 thru 3 of mon must be lower case
return (offset of (text 2 thru 3 of mon) in kStrMonths) div 2
end monthIndex
set theMonth to "Feb" -- or "feb" or "February", etc....
monthIndex(theMonth)
NG