On Tue, 28 Apr 2020 at 01:08, Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:
> Op 27-4-2020 om 19:05 schreef Richard Sargent:
>
> On Mon, Apr 27, 2020 at 9:27 AM Roelof Wobben via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
>
>> Hello,
>>
>> I wonder if it is possible
|s1 s2|
s1 := 'abcdefghijk'.
s2 := String streamContents: [:s |
s1 keysAndValuesDo: [:index :each |
(index \\ 3 = 1 and: [1 < index])
ifTrue: [s space].
s nextPut: each]].
is perhaps a little simpler. I generally prefer to have Smalltalk
do the counting for me.
On Tue, 28 Apr
--- Begin Message ---
This works
| s1 s2 |
s1 := 'abcdefghijk'.
s2 := String streamContents: [:s || in len |
in := ReadStream on: s1.
len := 0.
[in atEnd] whileFalse: [
s nextPut: in next.
len := len + 1.
(in atEnd not and: [ (len \\ 3) = 0]) ifTrue: [ s space ] ] ]
--- Begin Message ---
Op 27-4-2020 om 19:05 schreef Richard
Sargent:
On Mon, Apr 27, 2020 at 9:27
AM Roelof Wobben via Pharo-users
wrote:
Hello,
On Mon, Apr 27, 2020 at 9:27 AM Roelof Wobben via Pharo-users <
pharo-users@lists.pharo.org> wrote:
> Hello,
>
> I wonder if it is possible in Pharo to divide a string in lets say part
> of 3.
> so this : 'abcdefgh'
>
> would be 'abc def gh`
>
Do you really want a single string with spaces
--- Begin Message ---
Hello,
I wonder if it is possible in Pharo to divide a string in lets say part
of 3.
so this : 'abcdefgh'
would be 'abc def gh`
Regards,
Roelof
--- End Message ---