I have been trying to redefine the printOn method by using this code:
coordinates do: [:elem | aStream print: elem] separatedBy: [aStream print: ' ,']
where "coordinates" stands for the name of the collection (OrderedCollection), but i was expecting to print this when calling to Transcript show:
(2/2) ,(1/1) ,(3/3) ,(-4/4)
I got this instead:
(2/2)','(1/1)','(3/3)','(-4/4)
i. e the quotes was printed as well.
I have tried to play with it, defining a local variable and use it, etc. Nothing worked.
Don't use #print: to print strings. Use #nextPutAll: to be safe (works for all collections). #print: writes a string representation on the stream and surrounds the argument with quotes, that's why you get quotes in the output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With