how can I divide a string in parts of 5

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how can I divide a string in parts of 5

Pharo Smalltalk Users mailing list
Hello,

For another challenge of exercism I have to divide a string in parts of
max 5 characters.
so for example abcdefg willl be "abcde fg"

Any hints how I can achieve this ?

Roelof


Reply | Threaded
Open this post in threaded view
|

Re: how can I divide a string in parts of 5

jtuchel
Look at implementors and senders of #to:by:do: as a start. You can
iterate over a Collection (String is a Collection) making bigger steps.
Or look around for ReadStream and methods like #atEnd and #next:

HTH

Joachim



Am 10.09.20 um 13:48 schrieb Roelof Wobben via Pharo-users:

> Hello,
>
> For another challenge of exercism I have to divide a string in parts
> of max 5 characters.
> so for example abcdefg willl be "abcde fg"
>
> Any hints how I can achieve this ?
>
> Roelof
>
>
>

--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1