String>withBlanksTrimmed (another fix)

Georg Gollmann gollmann at edvz.tuwien.ac.at
Fri Feb 13 15:18:12 UTC 1998


String>withBlanksTrimmed still has Problems in 1.31. Here´s a fix that
should take care of all special cases.

withBlanksTrimmed
	"Return a copy of the receiver from which leading and trailing blanks
	have been trimmed. Simplified by Gerardo Richarte 11/3/97, fixed by
go 2/13/98"

	^ self
		copyFrom: ((self findFirst: [:eachChar | eachChar
isSeparator not]) max: 1)
		to: (self findLast: [:eachChar | eachChar isSeparator not])

	" ' abc  d   ' withBlanksTrimmed"


Georg

----
Dipl.Ing. Georg Gollmann                   TU-Wien, EDV-Zentrum

phon:(+43-1) 58801 - 5848
fax: (+43-1) 587 42 11
mail:gollmann at edvz.tuwien.ac.at
http://macos.tuwien.ac.at/Gollmann.html





More information about the Squeak-dev mailing list