Re: Maximum list size [was Re: Sifting a list sans loop]
Re: Maximum list size [was Re: Sifting a list sans loop]
- Subject: Re: Maximum list size [was Re: Sifting a list sans loop]
- From: email@hidden (Michael Sullivan)
- Date: Sat, 9 Feb 2002 12:51:24 -0500
- Organization: Society for the Incurably Pompous
>
At the end of January a thread started about the length of lists. It broke
>
around 4060+ items. The problem is when you do a very simple splitting of a
>
long text with the command
>
set mText to (characters 1 to 5000 of mFullText) as string
>
I get that stack overflow error
>
Is this bug going to get fixed or do we have to split our result into
>
partial lists that are smaller that breaking point of around 4000 items?
Yes, sort of. If you read the whole thread, you'd realize that lists
can be *much* longer than 5000 items (I think they are limited only by
available memory), but you can't put more than 4070-odd items into one
(or create a new list from scratch of more than 4070-odd items) in a
single command.
So you do have to work around it, but you don't have to limit yourself
to never *using* lists longer than 4000 items.
-- here's a example handler:
on FrontSubString(theString,noChars)
set count to (noChars / 4000) as integer
set last to noChars mod 4000
set mText to ""
repeat with i from 0 to count -1
set mText to mText & (characters i*4000 to i*4000 + 3999 of
theString) as string
end repeat
set mText to mText & (character count*4000 to count*4000 + last of
theString) as string
end FrontSubString
-- end handler
Michael
_______________________________________________
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.