> > But what I want is the 3 letters in foo. > > Think about displaying a table of values. If it contains a mixture of > numbers and strings, what I want to see is: > > 1 | string one | 3.1415 | string two > > not: > > 1 | 'string one' | 3.1415 | 'string two' > > > If I want the second form (with quotes) I can use #storeString / #storeOn:.
indeed. I do not get printString in String is storeOn: > What is the one message that I can send to a mixture of numbers and > strings that will return a string (or write to a stream) that will > display as shown in the first example above? Yes this is my point. In fact I do not know what I get. So now I'm forced to type check. Stef > > > Thanks, > Alistair > > > >> The problem is when you want to print 'foo' printString. >> You are in fact doing 'foo' printString printOn: aStream, IOW aStream >> nextPutAll: 'foo' printString printString. >> >> >> 2017-10-21 21:12 GMT+02:00 Stephane Ducasse <[email protected]>: >> >> Yes this is my point. I was surprised to get ' on the transcript. >> >> Stef >> >> On Sat, Oct 21, 2017 at 7:49 PM, Alistair Grant >> <[email protected]> >> wrote: >> > On Sat, Oct 21, 2017 at 05:28:21PM +0200, Stephane Ducasse wrote: >> >> Hi >> >> >> >> I would like to really understand why >> >> 'foo' printString >> >> >>> >> >> '''foo''' >> >> >> >> and not why this is not >> >> >> >> 'foo' >> >> >> >> itself. >> >> >> >> Stef >> > >> > I can't comment on the original thinking behind this, but I agree >> that >> > something like: >> > >> > >> > String>>printOn: aStream >> > "Represent the receiver on the supplied stream" >> > >> > aStream nextPutAll: self >> > >> > >> > >> > would be much better. >> > >> > If we're displaying values such as numbers and strings in a UI, >> e.g. >> > table, we normally don't want the strings always enclosed in >> quotes. >> > >> > Cheers, >> > Alistair >> > >> > >> >> >> >> >> >
