How would I merge/convert a list, that looks something like this.
{{"62534","8765234","786345"},{"85476","762354","689785"}}
To this
{"62534","8765234","786345","85476","762354","689785"}
/mkh
How would I merge/convert a list, that looks something like this.
{{"62534","8765234","786345"},{"85476","762354","689785"}}
To this
{"62534","8765234","786345","85476","762354","689785"}
/mkh
If you’re only dealing with text, you might be able to use something like this:
set example to {{"62534", "8765234", "786345"}, {"85476", "762354", "689785"}}
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to character id 0
set example to text items of ("" & example)
set text item delimiters of AppleScript to prevTIDs
example
The best option would probably involve a loop:
set example to {{"62534", "8765234", "786345"}, {"85476", "762354", "689785"}}
set modifiedExample to {}
repeat with thisList in example
repeat with thisItem in thisList
set end of modifiedExample to contents of thisItem
end repeat
end repeat
modifiedExample
Thank you SO much, I was doing something like this but was using words of insted of " contents "
/mkh
You can decrease the kitten mortality rate if you do it this way:
tell ({{"62534", "8765234", "786345"}, {"85476", "762354", "689785"}}) to its item 1 & its item 2
Or if, in general, you don’t know how many items are in the initial list:
set L to {{"62534", "8765234", "786345"}, {"85476", "762354", "689785"}}
set NL to {}
repeat with I in L
set NL to NL & items of I
end repeat
NL --> {"62534", "8765234", "786345", "85476", "762354", "689785"}
that will kill even less kittens! hoorayy!!!
Has the advantage too, hendo, that it doesn’t matter what the “items” are:
set L to {{true, "Adam", "786345"}, {{1, 2, 3}, 435.4, {Bell:71}}, {pi, "purple"}}
set NL to {}
repeat with I in L
set NL to NL & items of I
end repeat
NL --> {true, "Adam", "786345", {1, 2, 3}, 435.4, {Bell:71}, 3.14159265359, "purple"}
The list referenced by I contains the same items as the list created with ‘items of I’. ![]()
set L to {{true, "Adam", "786345"}, {{1, 2, 3}, 435.4, {Bell:71}}, {pi, "purple"}}
set NL to {}
repeat with I in L
set NL to NL & I
end repeat
NL --> {true, "Adam", "786345", {1, 2, 3}, 435.4, {Bell:71}, 3.14159265359, "purple"}
Ah well; wasn’t sure, didn’t try. :rolleyes: