Christoph Thiede uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-ct.1034.mcz
==================== Summary ====================
Name: Collections-ct.1034 Author: ct Time: 20 May 2023, 1:33:29.111278 pm UUID: e23dc425-a4b4-de4c-91bc-19772d83f449 Ancestors: Collections-ct.1033
Adds String>>#beginsWith:caseSensitive: and #endsWith:caseSensitive:.
=============== Diff against Collections-ct.1033 ===============
Item was added: + ----- Method: String>>beginsWith:caseSensitive: (in category 'testing') ----- + beginsWith: sequence caseSensitive: caseSensitive + "Answer if the receiver starts with the argument collection." + + | index sequenceSize | + caseSensitive ifTrue: [^ self beginsWith: sequence]. + sequenceSize := sequence size. + self size < sequenceSize ifTrue: [ ^false ]. + index := 0. + [ (index := index + 1) <= sequenceSize ] whileTrue: [ + ((sequence at: index) sameAs: (self at: index)) ifFalse: [ ^false ] ]. + ^true!
Item was added: + ----- Method: String>>endsWith:caseSensitive: (in category 'testing') ----- + endsWith: sequence caseSensitive: caseSensitive + "Answer if the receiver ends with the argument collection." + + | index sequenceSize offset | + caseSensitive ifTrue: [^ self endsWith: sequence]. + sequence isString ifFalse: [ ^super endsWith: sequence ]. + sequenceSize := sequence size. + (offset := self size - sequenceSize) < 0 ifTrue: [ ^false ]. + index := 0. + [ (index := index + 1) <= sequenceSize ] whileTrue: [ + ((sequence at: index) sameAs: (self at: index + offset)) ifFalse: [ ^false ] ]. + ^true!
Item was changed: ----- Method: String>>linesDo: (in category 'accessing') ----- linesDo: aBlock + "Execute aBlock with each line in the receiver. The terminating line delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock." - "Execute aBlock with each line in this string. The terminating line delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock"
self lineIndicesDo: [:start :endWithoutDelimiters :end | aBlock value: (self copyFrom: start to: endWithoutDelimiters)]!
squeak-dev@lists.squeakfoundation.org