[squeak-dev] The Trunk: Collections-edc.314.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Feb 24 10:41:33 UTC 2010
Edgar J. De Cleene uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-edc.314.mcz
==================== Summary ====================
Name: Collections-edc.314
Author: edc
Time: 24 February 2010, 7:46:05.588 am
UUID: 74aa25e4-9646-4f83-9141-e72890b6cd4e
Ancestors: Collections-ul.313
Added String-lastPositionOf convenience method
=============== Diff against Collections-ul.313 ===============
Item was added:
+ ----- Method: String>>lastPositionOf: (in category 'testing') -----
+ lastPositionOf: aChar
+ "Answer the character position of the final space or other separator character in the receiver, and 0 if none"
+ self size to: 1 by: -1 do:
+ [:i | ((self at: i)= aChar) ifTrue: [^ i]].
+ ^ 0
+
+ "
+ 'fred the bear' lastSpacePosition
+ 'ziggie' lastSpacePosition
+ 'elvis ' lastSpacePosition
+ 'wimpy ' lastSpacePosition
+ '' lastSpacePosition
+ "!
More information about the Squeak-dev
mailing list
|