[Newbies] Global string search and replace in an image
Chris Cunnington
smalltalktelevision at gmail.com
Mon Sep 10 23:43:21 UTC 2012
On 12-09-10 7:34 PM, Andy Burnett wrote:
> Hello,
>
> Is there a method - or other mechanism - that would let me find all
> instances of 'foo' and replace them with 'bar' within an image? I
> imagine there must be, but I can't find it.
>
> Cheers
> Andy
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
Try this:
OrderedCollection allInstances size
Print that. That's the number of instances of OC in the image. Now try
OrderedCollection allInstances
or
OrderedCollection allInstances first
And take a look at the living instances inside the image. That's how you
find instances. Replacing them is kind of a different issue. I'd say two
things about that. The first is you don't want to just replace instances
in the image. You need to be more specific of the context of your
instances. Are they in an OrderedCollection or an Array? If so, find
that instance and change them inside.
The second thing is you wouldn't generally replace instances in the
image. Just wait and they'll be eaten by the garbage collector.
So finding instances is not to hard. Use #allInstances. To replace them
you need to look not so much at the whole image but the application
those instances are in. Inside your app.
Oh, yea. You can use OrderedCollection allIstances and both explore and
inspect. You can see inside the instances that way. (Explore and inspect
are one of the main menus.)
Hope that helps,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20120910/9f135fb8/attachment.htm
More information about the Beginners
mailing list