Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.261.mcz ==================== Summary ==================== Name: Collections-nice.261 Author: nice Time: 25 December 2009, 2:49:37 am UUID: e4274ddc-1d0c-436a-943a-2fce48421247 Ancestors: Collections-ul.260 Correct 2 typos in method name Occurance->Occurrence Deprecate old findLastOccuranceOfString:startingAt: =============== Diff against Collections-ul.260 =============== Item was changed: + ----- Method: PositionableStream>>copyPreamble:from:at: (in category 'filein/out') ----- + copyPreamble: preamble from: aStream at: pos - ----- Method: PositionableStream>>copyPreamble:from:at: (in category 'fileIn/Out') ----- - copyPreamble: preamble from: aStream at: pos "Look for a changeStamp for this method by peeking backward. Write a method preamble, with that stamp if found." | terminator last50 stamp i | terminator := $!!. "Look back to find stamp in old preamble, such as... Polygon methodsFor: 'private' stamp: 'di 6/25/97 21:42' prior: 34957598!! " aStream position: pos. + aStream backChunk. "to beginning of method" + last50 := aStream backChunk. "to get preamble" - aStream backChunk. "to beginning of method" - last50 := aStream backChunk. "to get preamble" aStream position: pos. - stamp := String new. + (i := last50 + findLastOccurrenceOfString: 'stamp:' + startingAt: 1) > 0 ifTrue: + [ stamp := (last50 + copyFrom: i + 8 + to: last50 size) copyUpTo: $' ]. - (i := last50 findLastOccuranceOfString: 'stamp:' startingAt: 1) > 0 ifTrue: - [stamp := (last50 copyFrom: i+8 to: last50 size) copyUpTo: $']. "Write the new preamble, with old stamp if any." + self + cr; + nextPut: terminator. + self nextChunkPut: (String streamContents: + [ :strm | + strm nextPutAll: preamble. + stamp size > 0 ifTrue: + [ strm + nextPutAll: ' stamp: '; + print: stamp ] ]). - self cr; nextPut: terminator. - self nextChunkPut: (String streamContents: - [:strm | - strm nextPutAll: preamble. - stamp size > 0 ifTrue: - [strm nextPutAll: ' stamp: '; print: stamp]]). self cr! Item was added: + ----- Method: String>>findLastOccurrenceOfString:startingAt: (in category 'accessing') ----- + findLastOccurrenceOfString: subString startingAt: start + "Answer the index of the last occurrence of subString within the receiver, starting at start. If + the receiver does not contain subString, answer 0. Case-sensitive match used." + + | last now | + last := self findString: subString startingAt: start. + last = 0 ifTrue: [^ 0]. + [last > 0] whileTrue: + [now := last. + last := self findString: subString startingAt: last + 1]. + + ^ now + ! Item was changed: + ----- Method: String>>findLastOccuranceOfString:startingAt: (in category 'deprecated-3.10') ----- - ----- Method: String>>findLastOccuranceOfString:startingAt: (in category 'accessing') ----- findLastOccuranceOfString: subString startingAt: start + self deprecated: 'Use instead #findLastOccurrenceOfString:startingAt:'. + ^ self findLastOccurrenceOfString: subString startingAt: start ! - "Answer the index of the last occurance of subString within the receiver, starting at start. If - the receiver does not contain subString, answer 0." - - | last now | - last := self findString: subString startingAt: start. - last = 0 ifTrue: [^ 0]. - [last > 0] whileTrue: [ - now := last. - last := self findString: subString startingAt: last + 1. - ]. - - ^ now. - ! |
Free forum by Nabble | Edit this page |