[squeak-dev] The Trunk: Collections-mt.605.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 30 06:47:07 UTC 2015


Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.605.mcz

==================== Summary ====================

Name: Collections-mt.605
Author: mt
Time: 30 March 2015, 8:46:49.164 am
UUID: b661cec7-af10-7a42-9c4c-a09449425548
Ancestors: Collections-ul.604

Support #withBlanksTrimmed in texts.

=============== Diff against Collections-ul.604 ===============

Item was added:
+ ----- Method: String class>>noSeparators (in category 'accessing') -----
+ noSeparators
+ 	^ CSNonSeparators!

Item was added:
+ ----- Method: Text>>withBlanksTrimmed (in category 'converting') -----
+ withBlanksTrimmed
+ 	"Return a copy of the receiver from which leading and trailing blanks have been trimmed."
+ 
+ 	| first last |
+ 	first := string indexOfAnyOf: String noSeparators startingAt: 1 ifAbsent: [0].
+ 	first = 0 ifTrue: [ ^'' ].  "no non-separator character"
+ 	last := string lastIndexOfAnyOf: String noSeparators startingAt: self size ifAbsent: [self size].
+ 	(first = 1 and: [ last = self size ]) ifTrue: [ ^self copy ].
+ 	^self
+ 		copyFrom: first
+ 		to: last
+ !



More information about the Squeak-dev mailing list