Re: make a list
Re: make a list
- Subject: Re: make a list
- From: Christopher Stone <email@hidden>
- Date: Fri, 5 Dec 2003 11:22:02 -0600
At 16:58 +0100 12/05/2003, Sascha Kuehn wrought:
i need to make a list of lists from a tab and return delimited string
...
but this is to slow.
i.e. the script needs for 188 text items of x about a minute on a eMac
1Ghz!
______________________________________________________________________
Hello Sascha,
set d to "data1 data2 data3
data4 data5 data6
data7 data8 data9"
set newData to {}
set AppleScript's text item delimiters to {return}
set d to text items of d
set AppleScript's text item delimiters to {tab}
repeat with i from 1 to count of d
copy (text items of item i of d) to end of newData
end repeat
set AppleScript's text item delimiters to {""}
newData
On my dual 867 G4 this takes about 0.1 seconds to parse 200 lines.
You could also use the Satimage osax:
set theData to "data1 data2 data3
data4 data5 data6
data7 data8 data9"
set newData to {}
try
set theData to find text "^.+$" in theData with regexp, all
occurrences and string result without case sensitive
on error
set theData to false
end try
repeat with i from 1 to count of theData
set end of newData to find text "[^ ]+" in (item i of theData) with
regexp, all occurrences and string result without case sensitive
end repeat
On my system it's a tad slower ~ 0.19 seconds.
Satimage osax: <
http://www.satimage.fr/software/en/softx.html>
Chris
_______________________________________________
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.
References: | |
| >make a list (From: Sascha Kuehn <email@hidden>) |