Re: getting chunks of text
Re: getting chunks of text
- Subject: Re: getting chunks of text
- From: Scott Haneda <email@hidden>
- Date: Thu, 17 Mar 2005 02:19:43 -0800
on 3/17/05 1:44 AM, Andrew Oliver at email@hidden wrote:
> On 3/16/05 7:40 PM, "Scott Haneda" <email@hidden> wrote:
>
>> Given a string of length unknown, I need to chop it up to less than 256
>> characters, however, I do not want to chop a word in half, so scan backwards
>> to the first space before 256 chars. Not to worried about what would happen
>> when running into punctuation and such.
>>
>> I need a result set that I can repeat through, thanks.
>
> Here's one approach.
>
> It works by progressing through the text items of the source text until word
> n+1 trips the 256 character limit at which point it saves state and starts a
> new 'chunk'.
>
> It's not fast, and there are several optimization techniques I can think of
> trying, but if you're dealing with SMS messages I'm guessing you not going
> to be processing novels through this thing.
Much appreciated, that worked perfectly for me.
--
-------------------------------------------------------------
Scott Haneda Tel: 415.898.2602
<http://www.newgeo.com> Novato, CA U.S.A.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden