Re: Converting a nested list to return delimited string with TIDs
Re: Converting a nested list to return delimited string with TIDs
- Subject: Re: Converting a nested list to return delimited string with TIDs
- From: Chris Page <email@hidden>
- Date: Thu, 07 Jun 2001 01:00:53 -0700
nigh on 2001.06.06 11:00 PM, Paul Berkowitz at email@hidden wrote:
>
On 6/6/01 9:54 PM, "Ehsan Saffari" <email@hidden> wrote:
>
>
> I have a nested list:
>
>
>
> {{"aa","bb","cc"},{"dd","ee","ff"}}
>
>
>
> and I want to convert it to:
>
> "aa"
>
> "bb"
>
> "cc"
>
>
>
> "dd"
>
> "ee"
>
> "ff"
>
>
>
> is this possible with TIDs? I've already done this with a repeat loop,
>
> but can't figure out if TIDS can be applied to a list.
>
>
>
Applying TIDs in the ordinary way will turn any list, including complex
>
nested ones, into a single string. That's what 'text item delimiters' are
>
for, to delimit items of a continuous string. E.g.:
>
>
set n to {{"aa", "bb", "cc"}, {"dd", "ee", "ff"}}
>
set AppleScript's text item delimiters to {return}
>
set n to n as string
>
set AppleScript's text item delimiters to {""}
>
n
>
>
-->
>
"aa
>
bb
>
cc
>
dd
>
ee
>
ff"
>
>
To get what you want - separate strings on separate lines -- is not, I
>
think, possible within AppleScript itself.
How about using a repeat loop over the list, converting each sub-list into a
string, then concatenating them together with whatever separator is desired
between them?
--
Chris Page
Mac OS Lead, Palm Desktop
Palm, Inc.