The Trunk: Collections-mt.780.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-mt.780.mcz

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

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

Name: Collections-mt.780
Author: mt
Time: 25 January 2018, 8:17:31.08605 am
UUID: 20b43cba-f50d-4f4c-97f7-85d93f6bd4f5
Ancestors: Collections-eem.779

Adds convenience API to Text that matches the one in String. Reduces the need for #asString is many cases. Look into Text's protocol "Converting" so see what we already have in this regard.

This is basically a tooling thing where texts (i.e. formatted strings) appear in places where you would just work with the String API.

=============== Diff against Collections-eem.779 ===============

Item was added:
+ ----- Method: Text>>asSymbol (in category 'converting') -----
+ asSymbol
+
+ ^ self asString asSymbol
+ !

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