[Pkg] The Trunk: Collections-cmm.1017.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Jul 7 04:27:27 UTC 2022
Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.1017.mcz
==================== Summary ====================
Name: Collections-cmm.1017
Author: cmm
Time: 6 July 2022, 11:27:25.948092 pm
UUID: 871747c5-a53b-4897-81c4-ece30bc41631
Ancestors: Collections-cmm.1016
Include support method missing from Collections-cmm.1016.
=============== Diff against Collections-cmm.1016 ===============
Item was added:
+ ----- Method: String>>numberOrValue (in category 'formatting') -----
+ numberOrValue
+ "If I'm 100% digits, answer my numerical value, otherwise, answer myself."
+ | number |
+ number := 0.
+ self size
+ to: 1
+ by: -1
+ do:
+ [ : pos | | digit |
+ digit := self at: pos.
+ digit isDigit ifFalse: [ ^ self ].
+ number := number + ((10 raisedTo: self size - pos) * digit digitValue) ].
+ ^ number!
More information about the Packages
mailing list