CharacterArray.st
changeset 9306 de9b438212b8
parent 9282 f6d9d4129919
child 9391 dd326603ae7e
equal deleted inserted replaced
9305:6836bc44f3c3 9306:de9b438212b8
  2678     |tmpStream idx idx1|
  2678     |tmpStream idx idx1|
  2679 
  2679 
  2680     tmpStream := WriteStream on:(self class new).
  2680     tmpStream := WriteStream on:(self class new).
  2681     idx := 1.
  2681     idx := 1.
  2682     [idx ~~ 0] whileTrue:[
  2682     [idx ~~ 0] whileTrue:[
  2683 	idx1 := idx.
  2683         idx1 := idx.
  2684 	idx := self indexOfSubCollection:subString startingAt:idx.
  2684         idx := self indexOfSubCollection:subString startingAt:idx.
  2685 	idx ~~ 0 ifTrue:[
  2685         idx ~~ 0 ifTrue:[
  2686 	    tmpStream nextPutAll:(self copyFrom:idx1 to:idx-1).
  2686             tmpStream nextPutAll:(self copyFrom:idx1 to:idx-1).
  2687 	    tmpStream nextPutAll:newString.
  2687             tmpStream nextPutAll:newString.
  2688 	    idx := idx + subString size
  2688             idx := idx + subString size
  2689 	]
  2689         ]
  2690     ].
  2690     ].
  2691     tmpStream nextPutAll:(self copyFrom:idx1).
  2691     tmpStream nextPutAll:(self copyFrom:idx1).
  2692     ^ tmpStream contents
  2692     ^ tmpStream contents
  2693 
  2693 
  2694    "
  2694    "
  2695      '12345678901234567890' replString:'123' withString:'OneTwoThree'
  2695      '12345678901234567890' copyReplaceString:'123' withString:'OneTwoThree'
  2696      '12345678901234567890' replString:'123' withString:'*'
  2696      '12345678901234567890' copyReplaceString:'123' withString:'*'
  2697      '12345678901234567890' replString:'234' withString:'foo'
  2697      '12345678901234567890' copyReplaceString:'234' withString:'foo'
  2698 
  2698 
  2699      ('a string with spaces' replChar:$  withString:' foo ')
  2699      ('a string with spaces' copyReplaceAll:$  withAll:' foo ')
  2700 	replString:'foo' withString:'bar'
  2700         copyReplaceString:'foo' withString:'bar'
  2701     "
  2701     "
  2702 
  2702 
  2703     "Modified: / 31-05-1999 / 12:33:59 / cg"
  2703     "Modified: / 31-05-1999 / 12:33:59 / cg"
  2704     "Created: / 12-05-2004 / 12:00:00 / cg"
  2704     "Created: / 12-05-2004 / 12:00:00 / cg"
  2705 !
  2705 !
  5270 ! !
  5270 ! !
  5271 
  5271 
  5272 !CharacterArray class methodsFor:'documentation'!
  5272 !CharacterArray class methodsFor:'documentation'!
  5273 
  5273 
  5274 version
  5274 version
  5275     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.340 2006-03-15 10:33:32 cg Exp $'
  5275     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.341 2006-03-29 08:43:31 stefan Exp $'
  5276 ! !
  5276 ! !
  5277 
  5277 
  5278 CharacterArray initialize!
  5278 CharacterArray initialize!