[squeak-dev] One liner challenge
Alan Knight
knight at acm.org
Fri Mar 12 13:17:48 UTC 2010
VisualWorks has that one, as #through:, and the #corresponding throughAll: for a collection argument.
At 11:56 PM 2010-03-11, Josh Gargus wrote:
>#upTo: is inconvenient for this because the result doesn't include the matched character. If we had #upToWith: we could write:
>
>| in | in := 'This is a (string) with some (parenthetical fields)' readStream.
>String streamContents: [:out | [in atEnd] whileFalse: [out nextPutAll: (in upToWith: $( ); nextPutAll: (in upToWith: $) ) asUppercase]]
>
>Cheers,
>Josh
>
>
>On Mar 11, 2010, at 7:34 PM, Randal L. Schwartz wrote:
>
>>>>>>> "Travis" == Travis Griggs <travisgriggs at gmail.com> writes:
>>
>> Travis> Given strings of the form
>>
>> Travis> 'This is a (string) with some (parenthetical fields)'
>>
>> Travis> turn them into
>>
>> Travis> 'This is a (STRING) with some (PARENTHETICAL FIELDS)'
>>
>> Somehow, I think streams and #upTo: are gonna be the key there.
>>
>> --
>> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
>> <merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
>> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
>> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
>>
--
Alan Knight [|], Engineering Manager, Cincom Smalltalk
knight at acm.org
aknight at cincom.com
http://www.cincom.com/smalltalk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100312/d46ba080/attachment.htm
More information about the Squeak-dev
mailing list
|