Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make a list



So for a string with return-tab record structure you would:

set ResultLst to {}
set RecordsLst to returnsTokens("YourDataHere", return)
repeat with i from 1 to (length of RecordsLst )
set curRecord to item i of RecordsLst
set end of ResultLst to returnsTokens(curRecord ,tab)
end repeat


> Hi Sascha,
> try this:
>
> on returnsTokens(theString, theDelimiter)
> return call method "componentsSeparatedByString:" of [NO-BREAK]
> theString with parameter theDelimiter
> end returnsTokens
>
> Its pretty fast. You might want to have a look at the NSString and NSArray
> Obj-C classes, which offer a lot of functions for operations on strings and
> lists.
>
>> Sascha Kuehn :
>
>> hi,
>>
>> i need to make a list of lists from a tab and return delimited string
>> like : "data1 [tab] data2 [tab] data3 [return] data4 [tab] data5 [tab]
>> data6"
>> [tab] and [return] are the delimiters!!
>>
>> this string should become a list like: {{"data1", "data2",
>> "data3"},{"data4", "data5", "data6"}}
>>
>> i have an applescrip:
>>
>> set x to (mysql's ExecuteMySQLCommand(sqlCommand))
>> set addressData to {}
>> set AppleScript's text item delimiters to return
>> repeat with i from 1 to count text items of x
>> if i - 1 then
>> set y to text item i of x
>> set AppleScript's text item delimiters to tab
>> set _name to text item 1 of y & " " & text item 2 of y
>> set end of addressData to {_name, text item 3 of y, text item 4 of
>> y, text item 5 of y}
>> set AppleScript's text item delimiters to return
>> end if
>> end repeat
>>
>> but this is to slow.
>> i.e. the script needs for 188 text items of x about a minute on a eMac
>> 1Ghz!
>>
>> i guess a c++ routine will be much faster bu i don't have any
>> experiences with c++ so anybody can help me?
>>
>> Sascha
>> _______________________________________________
>> applescript-studio mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/applescript-studio
>> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> applescript-studio mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/applescript-studio
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: make a list (From: klaus umland <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.