Bram Neijt wrote:
> The following puzzles me (in gst):
> st> 'a/b' indexOf: '/' ifAbsent: ['ABSENT' printNl]!
> 'ABSENT'
> 'ABSENT'
Here is the doc for (String whichClassIncludesSelector:
#indexOf:ifAbsent:) >> #indexOf:ifAbsent:
indexOf: anElement ifAbsent: exceptionBlock
Answer the index of the first occurrence of anElement in the
receiver. Invoke exceptionBlock and answer its result if no item
is found
Now, ask yourself, what does "anElement" mean in the context of
Strings? Hint: the element '/' is in fact *not* present in the String
'a/b'. Also look around SequenceableCollection's 'basic' methods for
the method that does what you expect here.
--
Stephen Compall
http://scompall.nocandysw.com/blog
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk