StringCollection.st
changeset 10452 2f486960b688
parent 9161 1ad4d98f8f62
child 10909 5f5e63c29ae2
equal deleted inserted replaced
10451:cb5c7b091764 10452:2f486960b688
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
       
    13 "{ Package: 'stx:libbasic' }"
    12 "{ Package: 'stx:libbasic' }"
    14 
    13 
    15 OrderedCollection subclass:#StringCollection
    14 OrderedCollection subclass:#StringCollection
    16 	instanceVariableNames:''
    15 	instanceVariableNames:''
    17 	classVariableNames:''
    16 	classVariableNames:''
   190      In order to get collect working, we have to undo this allocation"
   189      In order to get collect working, we have to undo this allocation"
   191 
   190 
   192     ^ (super copyEmpty:size) grow:0.
   191     ^ (super copyEmpty:size) grow:0.
   193 
   192 
   194     "Created: 14.2.1996 / 11:05:47 / stefan"
   193     "Created: 14.2.1996 / 11:05:47 / stefan"
       
   194 !
       
   195 
       
   196 withoutLeadingBlankLines
       
   197     "return a copy of the receiver with leading blank lines removed.
       
   198      If there are no leading blank lines, the original receiver is returned.
       
   199      If all lines are blank, an empty string collection is returned."
       
   200 
       
   201     |indexOfFirstNonBlankLine|
       
   202 
       
   203     self first isBlank ifTrue:[
       
   204         indexOfFirstNonBlankLine := self findFirst:[:line | line notNil and:[line isBlank not]].
       
   205         indexOfFirstNonBlankLine == 0 ifTrue:[ ^ self copyEmpty ].
       
   206         ^ self copyFrom:indexOfFirstNonBlankLine
       
   207     ].
       
   208     ^ self.
       
   209 
       
   210     "
       
   211 '1
       
   212 2
       
   213 3' asStringCollection withoutLeadingBlankLines     
       
   214     "
       
   215 
       
   216     "
       
   217 '
       
   218 2
       
   219 3' asStringCollection withoutLeadingBlankLines       
       
   220     "
       
   221 
       
   222     "
       
   223 '
       
   224 
       
   225 ' asStringCollection withoutLeadingBlankLines  
       
   226     "
   195 ! !
   227 ! !
   196 
   228 
   197 !StringCollection methodsFor:'printing & storing'!
   229 !StringCollection methodsFor:'printing & storing'!
   198 
   230 
   199 printString
   231 printString
   295 ! !
   327 ! !
   296 
   328 
   297 !StringCollection class methodsFor:'documentation'!
   329 !StringCollection class methodsFor:'documentation'!
   298 
   330 
   299 version
   331 version
   300     ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.36 2006-02-20 21:29:35 cg Exp $'
   332     ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.37 2007-03-15 10:19:06 cg Exp $'
   301 ! !
   333 ! !