'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 22 October 2008 at 6:02:27 pm'!

!String methodsFor: 'accessing' stamp: 'jdb 10/16/2008 10:29'!
stbLinesDo: aBlock
	"execute aBlock with each line in this string.  
	The terminating linefeeds are not included in what is passed to aBlock.
	If our last string does not end with a line feed, then we do not apply the block, we just return it.
	Otherwise, we return nil"
	
	| start end noLinefeed line|
	
	start _ 1.
	noLinefeed := false.
	
	[ start <= self size ] whileTrue: [
		end _ self indexOf: Character lf  startingAt: start  ifAbsent: [ noLinefeed := true.
																	self size + 1 ].
		end _ end - 1.

		line := self copyFrom: start to: end.

		noLinefeed 
			ifTrue:[^line]
			ifFalse:[aBlock value: line.
					start _ end + 2]
	 ].

	^nil
! !

