[squeak-dev] Hyphenation puzzle/exercise

Stéphane Rollandin lecteur at zogotounga.net
Fri Mar 10 00:40:09 UTC 2023


> Here is my take:
> 
> 	'eg11dc5cad154625885bc70d4f42818e'
> 		with: 'oooooooopooopooopooopooooooooooo'
> 		collect: [:c :h | h == $p ifTrue: [$-] ifFalse: [c]]
> 

... which is wrong:)

This works:


String streamContents: [:str |
	 'eg11dc5cad154625885bc70d4f42818e'
		with: 'oooooooopooopooopooopooooooooooo' do: [:c :h |
			h == $p ifTrue: [str nextPut: $-].
			str nextPut: c.]]


Stef


More information about the Squeak-dev mailing list