extensions.st
changeset 1071 aa0ecb4c9138
parent 1041 4e3b40303d42
equal deleted inserted replaced
1070:7b9c9cafec32 1071:aa0ecb4c9138
   330 ! !
   330 ! !
   331 
   331 
   332 !String methodsFor:'*monticello-squeakCompatibility'!
   332 !String methodsFor:'*monticello-squeakCompatibility'!
   333 
   333 
   334 withSqueakLineEndings
   334 withSqueakLineEndings
   335         "Answer a copy of myself in which all sequences of <CR><LF> or <LF> have been changed to <CR>"
   335         "Answer a copy of myself in which all sequences of 
       
   336          <CR><LF> or <LF> have been changed to <CR>.
       
   337          Notice; that ST/X uses LF as line end internally"
       
   338          
   336         | newText |
   339         | newText |
   337         (self includes: Character lf) ifFalse: [ ^self copy ].
   340         (self includes: Character lf) ifFalse: [ ^self copy ].
   338         newText := self copyReplaceAll: String crlf with: String cr.
   341         newText := self copyReplaceAll: String crlf with: String cr.
   339         (newText asString includes: Character lf) ifFalse: [ ^newText ].
   342         (newText asString includes: Character lf) ifFalse: [ ^newText ].
   340         ^newText copyReplaceAll: String lf with: String cr asTokens: false.
   343         ^newText copyReplaceAll: String lf with: String cr asTokens: false.
   341 
   344 
       
   345         "
       
   346          ('a' , String lf , 'b' ,
       
   347                String return , 'c' ,
       
   348                String crlf , 'd' ,
       
   349                String crlf) withSqueakLineEndings
       
   350         "
       
   351 
   342     "Created: / 26-08-2009 / 11:35:56 / Jaroslav Havlin <havlij6@fel.cvut.cz>"
   352     "Created: / 26-08-2009 / 11:35:56 / Jaroslav Havlin <havlij6@fel.cvut.cz>"
       
   353     "Modified (comment): / 26-08-2018 / 13:34:17 / Claus Gittinger"
   343 ! !
   354 ! !
   344 
   355 
   345 !StringCollection methodsFor:'converting'!
   356 !StringCollection methodsFor:'converting'!
   346 
   357 
   347 asStringWithNativeLineEndings
   358 asStringWithNativeLineEndings