[BUG]3.2g String>withBlanksTrimmed misnamed or miscommented
Richard A. O'Keefe
ok at cs.otago.ac.nz
Fri Jun 28 02:45:01 UTC 2002
String>withBlanksTrimmed is commented as removing leading and trailig
blanks. Actually it removes _separator_ chars, not just blanks.
We have
#withBlanksCondensed (bolot)
Comment says 'leading/trailing blanks removed
and consecutive white spaces condensed',
which would be an odd combination (internal TABs would be
converted to spaces, but leading and trailing TABs would be kept).
Makes two copies when only one is needed.
(OK, that's technically three copies, only two needed...)
#withBlanksTrimmed (jm)
Comment says 'leading and trailing blanks [are] trimmed'
but as Tim Rowledge notes, deals with separators.
Personally I read 'blanks' as meaning just spaces, so I claim it ought
to be at least recommented and probably renamed. A method to remove only
blanks may be useful?
#withSeparatorsCompacted (ls)
Comment says 'replace each sequences [sic] of whitespace by
a single space character'. Keeps leading and trailing layout
as single spaces: ' x y ' withSeparatorsCompacted => ' x y '
So are (TAB, LF, CR, space) 'whitespace', 'blanks', or 'separators'?
Since the predicate used is #isSeparator, ...
More information about the Squeak-dev
mailing list
|