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

Levente Uzonyi leves at elte.hu
Mon Mar 30 17:01:41 UTC 2015


On Mon, 30 Mar 2015, commits at source.squeak.org wrote:

> 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!

I like the idea of a shared CharacterSet with the non-separator 
characters, but IMHO it should be on the class side of CharacterSet and I 
prefer the name #nonSeparators.
Any objections?

Levente

>
> 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