[squeak-dev] Xtreams question - OC of chars to String
Bob Arning
arning315 at comcast.net
Sat Dec 29 17:52:33 UTC 2012
String withAll: yourCollection
as in...
String withAll: (#($a $b $c) asOrderedCollection)
On 12/29/12 12:30 PM, Chris Cunnington wrote:
> I have a question about converting an OrderedCollection full of chars
> into a string. [1]
>
> I would have thought there was a method like #asString that could be
> sent to an OrderedCollection to produce a string. I find myself having
> to do the process in three steps: 1) #reading the OC; 2) creating an
> empty string; and then, 3) iterating over every char to put it into
> the String.
>
> I think I'm missing a simpler way. Especially with Xtreams. Shouldn't
> I just use a filter, change the #contentSpecies, or something?
>
> Chris
>
>
> [1]
>
> startTag: data
> <action: 'element'>
> |tagdata str |
> tagdata := data second first reading.
> str := (String new: 20) writing.
> tagdata do: [:each| str put: each].
> ^'html ' , (data first second first asString) , $: , $' , (str
> close; terminal) , $'
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20121229/d0c52d04/attachment.htm
More information about the Squeak-dev
mailing list
|