--- a/CharacterArray.st Sat Nov 15 12:37:35 2008 +0100
+++ b/CharacterArray.st Sat Nov 15 12:39:09 2008 +0100
@@ -14,7 +14,7 @@
ByteArray variableByteSubclass:#CharacterArray
instanceVariableNames:''
classVariableNames:'PreviousMatch DecoderTables EncoderTables DecodingFailedSignal
- EncodingFailedSignal'
+ EncodingFailedSignal LastString LastShiftTable'
poolDictionaries:''
category:'Collections-Text'
!
@@ -2919,16 +2919,16 @@
|tmpStream idx idx1|
- tmpStream := WriteStream on:(self class new).
+ tmpStream := CharacterWriteStream on:(self class new).
idx := 1.
[idx ~~ 0] whileTrue:[
- idx1 := idx.
- idx := self indexOfSubCollection:subString startingAt:idx.
- idx ~~ 0 ifTrue:[
- tmpStream nextPutAll:(self copyFrom:idx1 to:idx-1).
- tmpStream nextPutAll:newString.
- idx := idx + subString size
- ]
+ idx1 := idx.
+ idx := self indexOfSubCollection:subString startingAt:idx.
+ idx ~~ 0 ifTrue:[
+ tmpStream nextPutAll:(self copyFrom:idx1 to:idx-1).
+ tmpStream nextPutAll:newString.
+ idx := idx + subString size
+ ]
].
tmpStream nextPutAll:(self copyFrom:idx1).
^ tmpStream contents
@@ -2939,7 +2939,7 @@
'12345678901234567890' copyReplaceString:'234' withString:'foo'
('a string with spaces' copyReplaceAll:$ withAll:' foo ')
- copyReplaceString:'foo' withString:'bar'
+ copyReplaceString:'foo' withString:'bar'
"
"Modified: / 31-05-1999 / 12:33:59 / cg"
@@ -4901,7 +4901,7 @@
^ (self indexOfSubCollection:aString startingAt:1 ifAbsent:0 caseSensitive:true) ~~ 0
"
- 'hello world' includesString:'hel'
+ 'hello world' includesString:'hel'
'hello world' includesString:'rld'
'hello world' includesString:'llo'
'hello world' includesString:'LLO'
@@ -4946,41 +4946,41 @@
subSize := subString size.
subSize == 0 ifTrue:[ "empty string matches"
- subString isString ifFalse:[
- self error:'non string argument' mayProceed:true.
- ].
- ^ index
+ subString isString ifFalse:[
+ self error:'non string argument' mayProceed:true.
+ ].
+ ^ index
].
tester := caseSensitive ifTrue:[ [:c1 :c2 | c1 = c2 ] ] ifFalse:[ [:c1 :c2 | c1 sameAs: c2 ] ].
mySize := self size.
firstChar := subString at:1.
caseSensitive ifTrue:[
- startIndex := self indexOf:firstChar startingAt:index.
+ startIndex := self indexOf:firstChar startingAt:index.
] ifFalse:[
- startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:index.
+ startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:index.
].
[startIndex == 0] whileFalse:[
- runIdx := startIndex.
- found := true.
- 1 to:subSize do:[:i |
- runIdx > mySize ifTrue:[
- found := false
- ] ifFalse:[
- (tester value:(subString at:i) value:(self at:runIdx)) ifFalse:[
- found := false
- ]
- ].
- runIdx := runIdx + 1
- ].
- found ifTrue:[
- ^ startIndex
- ].
- caseSensitive ifTrue:[
- startIndex := self indexOf:firstChar startingAt:(startIndex + 1)
- ] ifFalse:[
- startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:(startIndex + 1).
- ].
+ runIdx := startIndex.
+ found := true.
+ 1 to:subSize do:[:i |
+ runIdx > mySize ifTrue:[
+ found := false
+ ] ifFalse:[
+ (tester value:(subString at:i) value:(self at:runIdx)) ifFalse:[
+ found := false
+ ]
+ ].
+ runIdx := runIdx + 1
+ ].
+ found ifTrue:[
+ ^ startIndex
+ ].
+ caseSensitive ifTrue:[
+ startIndex := self indexOf:firstChar startingAt:(startIndex + 1)
+ ] ifFalse:[
+ startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:(startIndex + 1).
+ ].
].
^ exceptionBlock value
@@ -5523,7 +5523,7 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.386 2008-11-13 15:20:13 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.387 2008-11-15 11:39:09 cg Exp $'
! !
CharacterArray initialize!