[REBOL] Re: Tip for splitting very long string ?
From: pyxos:netcourrier at: 15-Apr-2002 16:29
That's just I want to avoid but thanks because it's always useful to have several solutions.
----Message d'origine----
>Date: Mon, 15 Apr 2002 08:27:36 -0500
>De: Joel Neely <joel.neely=40fedex.com>
>Sujet: =5BREBOL=5D Re: Tip for splitting very long string ?
>A: rebol-list=40rebol.com
>
>Hi, Richard,
>
>COFFRE Richard FTO wrote:
>>
>> Hi Rebol fellows,
>>
>> Is there a tip to quickly split a very long string more than
>> 2000 characters into n characters sub strings and to create
>> a list with these subsets ?
>> For instance :
>>
>...
>>
>> I want to split this string into substrings of 5 characters...
>>
>
>Here's a quick-and-dirty solution:
>
> >> longstring: =22abcdefghijklmnopqrstuvwxyz=22
> == =22abcdefghijklmnopqrstuvwxyz=22
> >> i: 1
> == 1
> >> stringblock: =5B=5D
> == =5B=5D
> >> while =5Bi <= length? longstring=5D =5B
> =5B append stringblock copy/part at longstring i 5
> =5B i: i + 5
> =5B =5D
> == 31
> >> stringblock
> == =5B=22abcde=22 =22fghij=22 =22klmno=22 =22pqrst=22 =22uvwxy=22 =22z=22=5D
> >>
>
>-jn-
>
>--
>; Joel Neely joeldotneelyatfedexdotcom
>REBOL =5B=5D do =5B do func =5Bs=5D =5B foreach =5Ba b=5D s =5Bprin b=5D =5D sort/skip
>do function =5Bs=5D =5Bt=5D =5B t: =22=22 foreach =5Ba b=5D s =5Brepend t =5Bb a=5D=5D
t =5D =7B
>=7C e s m=21zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub=7D 2 =5D
>--
>To unsubscribe from this list, please send an email to
>rebol-request=40rebol.com with =22unsubscribe=22 in the
>subject, without the quotes.
>
-------------------------------------------------
=22Sound Mind, Sound Body=22 Juv=E9nal
=22Lire et =EAtre curieux, c'est la m=EAme chose=22 Pascal Quignard
=22Qui triomphe de lui-m=EAme poss=E8de la force=22 Lao-Tseu, extrait du Tao Te King
=22Dans la course =E0 la qualit=E9, il n'y a pas de ligne d'arriv=E9e=22 David Kearns
Allez voir mon site : http://www.desala.org
-------------------------------------------------------------
NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, Toolbar...
Web/Wap : www.netcourrier.com
T=E9l=E9phone/Fax : 08 92 69 00 21 (0,34 =80 TTC/min)
Minitel: 3615 NETCOURRIER (0,15 =80 TTC/min)