• 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: Poke a char; next question - insert item in list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Reading a File (Was: Re: TextEdit and Text Item Delimiters)
  • Next by Date: breaking on newline
  • Previous by thread: RE: Poke a char; next question - insert item in list
  • Next by thread: Changing desktop picture in Mac OS X?
  • Index(es):
    • Date
    • Thread