Why doesn't this work??

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Why doesn't this work??

Rick Flower

I found this archived on the mailing list to add the missing
findString: startingAt: method ala VisualWorks :


CharacterArray extend [
        findString: subString startingAt: start [
    <category: 'VisualWorks compatibility'>
    "Answer the index of subString within the receiver, starting at
start.
         If no such match is found, answer 0. "
       ^self indexOfSubCollection: subString startingAt: start
        ]
]

When I try to use it as in this example :

Transcript show: (cwd findString: 'export' startingAt: 1).
(assuming my cwd is something like /export/home/foo/bar)

GST emits the following message and hangs..
  Object: 2

Any ideas why this isn't working?  I just want to be
able to find the index of a substring so I can chop
a path down when I'm looking for a specific path
component within a path (e.g. in the example below,
I'd be looking for "directory" in the path and
return everything to the left of the "directory"
path string)

From:
/a/path/to/my/long/directory/is/here

To:
/a/path/to/my/long/directory

Thx!

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Why doesn't this work??

Rick Flower
On Fri, 14 May 2010 15:13:17 -0700, Rick Flower <[hidden email]>
wrote:

I forgot to mention I'm using GST 3.1 on Solaris if
that matters..

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Why doesn't this work??

Rick Flower
In reply to this post by Rick Flower
On Fri, 14 May 2010 15:13:17 -0700, Rick Flower <[hidden email]>
wrote:

Nevermind.. it was apparently something related to
jamming it all on the Transcript line.. Once I broke
it out into several steps then it worked OK..

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Why doesn't this work??

Paolo Bonzini-2
> Nevermind.. it was apparently something related to
> jamming it all on the Transcript line.. Once I broke
> it out into several steps then it worked OK..

I don't have a 3.1 binary at hand, but you needed "Transcript print:
(... findString: ...)" instead.

The hang is fixed in 3.2.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Why doesn't this work??

Rick Flower
On Sun, 16 May 2010 08:58:44 +0200, Paolo Bonzini <[hidden email]> wrote:
>> Nevermind.. it was apparently something related to
>> jamming it all on the Transcript line.. Once I broke
>> it out into several steps then it worked OK..
>
> I don't have a 3.1 binary at hand, but you needed "Transcript print:
> (... findString: ...)" instead.
>
> The hang is fixed in 3.2.

Thanks!  Good to know.

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk