Re: Poke a char; next question - insert item in list
Re: Poke a char; next question - insert item in list
- Subject: Re: Poke a char; next question - insert item in list
- From: "Arthur J. Knapp" <email@hidden>
- Date: Wed, 31 Jul 2002 20:40:58 -0400
>
From: email@hidden
>
Date: Wed, 31 Jul 2002 17:58:34 EDT
>
Subject: RE: Poke a char; next question - insert item in list
>
... how do I insert an additional list item in the
>
middle of the list readily (or do I have to copy the prior
>
& post parts of the list to a new list variable with the
>
addition of the item to be added)?
You seem to be fond of answering your own questions... ;-)
on InsertAt( a, i, v )
if ( i = 1 ) then return {v} & a
if ( i > a's length ) then return a & {v}
return `
a's items 1 thru (i - 1) & `
{v} & `
a's items (i + 1) thru -1
end
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
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.