help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Why doesn't this work??


From: Rick Flower
Subject: [Help-smalltalk] Why doesn't this work??
Date: Fri, 14 May 2010 15:13:17 -0700
User-agent: RoundCube Webmail/0.2.1

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!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]