• 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: Converting a nested list to return delimited string with TIDs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting a nested list to return delimited string with TIDs


  • Subject: Re: Converting a nested list to return delimited string with TIDs
  • From: Paul Berkowitz <email@hidden>
  • Date: Thu, 07 Jun 2001 01:43:52 -0700

On 6/6/01 11:00 PM, I wrote:

> set AppleScript's text item delimiters to {"\"" & return & "\""}
> set n to {{"aa", "bb", "cc"}, {"dd", "ee", "ff"}}
> set n to "\"" & n & "\""
> set AppleScript's text item delimiters to {""}
> n
>
>
> -->
> "\"aa\"
> \"bb\"
> \"cc\"
> \"dd\"
> \"ee\"
> \"ff\""
>
> which will show up in any text application just as you want:
>
> "aa"
> "bb"
> "cc"
> "dd"
> "ee"
> "ff"

Sorry. I forgot you wanted an extra line space between the converted
subgroups. I can't see any way to do that without a repeat loop (again for
the reasons given in my first post -- TIDs wipe out all internal nesting of
sublists), but here's a very simple one that uses TIDs tp speed things up:

set n to {{"aa", "bb", "cc"}, {"dd", "ee", "ff"}}
set AppleScript's text item delimiters to {"\"" & return & "\""}
repeat with i from 1 to (count n)
set item i of n to "\"" & (item i of n) & "\""
end repeat
set AppleScript's text item delimiters to {return & return}
set n to "" & n
set AppleScript's text item delimiters to {""}
n


--In a scriptable text application, continuing:

tell application "Tex-Edit Plus"
if not (document 1 exists) then make new document
set selection of document 1 to n
end tell


--that will show up as:

"aa"
"bb"
"cc"

"dd"
"ee"
"ff"


--
Paul Berkowitz


  • Prev by Date: Re: Converting a nested list to return delimited string with TIDs
  • Next by Date: Dropping text on to Droplets
  • Previous by thread: Re: Converting a nested list to return delimited string with TIDs
  • Next by thread: RE: Converting a nested list to return delimited string with TIDs
  • Index(es):
    • Date
    • Thread