Paolo Bonzini wrote: > >> I said this wasn't the finest part of the class library, because (a) you >> might reasonably expect #indexOf:ifAbsent: and >> #indexOf:matchCase:startingAt: to be variations on a theme, and they're >> not; and (b) they're all pretty wordy when all you're wanting to do is >> some string wrangling. >> > > Yeah, I remember thinking about the same when I ported this from IBM > Smalltalk. Which makes me think it's now exactly 10 years I've been > working on GNU Smalltalk. Wow.
Congratulations, I think. *dons party hat* >> My advice, if you are working a lot with strings, is to add a method >> like this: >> >> CharacterArray methodsFor: 'syntactic sugar'! >> >> % aSubString >> ^self indexOfSubCollection: aSubString >> ! ! >> >> Now you have: >> >> st> 'a/b' % '/' ! >> 2 >> > > While I agree entirely with you, why the "%"? :-P I was looking for a binary selector. I seriously considered @? but settled on % because it suggests modulo division... this made sense at the time :-I 'Interesting' choice of selectors aside, it's really the ease of doing this that I was trying to draw attention to. Mike _______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
