I've put a new goodie up on my site
(
http://www.nls.net/mp/jarvis/Bob/DolphinGoodies.htm) which
almost-but-not-quite implements the ANSI version of
String>>subStrings: correctly. In the base image String>>subStrings:
behaves in a non-standard way when the argument to this method is a
String. AlmostAnsiSubstrings preserves this non-standard behavior,
but implements correct-per-the-standard behavior when the argument to
String>>subStrings: is any sort of SequenceableCollection *except*
String. Thus
'-+abc-def-+ghi+-' subStrings: '-+'
incorrectly (based on the ANSI definition of 'correct' behavior - see
section 5.7.10.15 of the ANSI Smalltalk standard) answers
#('' 'abc-def' 'ghi+-')
while
'-+abc-def-+ghi+-' subStrings: '-+' asArray
correctly (based on the ANSI definition of 'correct') answers
#('abc' 'def' 'ghi')
The new goodie is called AlmostAnsiSubstrings. Share and enjoy.