--- a/CharacterArray.st Tue Apr 30 10:54:00 2013 +0100
+++ b/CharacterArray.st Tue May 21 21:58:09 2013 +0100
@@ -283,7 +283,6 @@
"Created: 3.8.1997 / 18:16:40 / cg"
! !
-
!CharacterArray class methodsFor:'cleanup'!
lowSpaceCleanup
@@ -327,7 +326,6 @@
"
! !
-
!CharacterArray class methodsFor:'pattern matching'!
matchEscapeCharacter
@@ -679,7 +677,6 @@
^ self == CharacterArray
! !
-
!CharacterArray methodsFor:'Compatibility-ANSI'!
addLineDelimiters
@@ -1571,7 +1568,6 @@
! !
-
!CharacterArray methodsFor:'character searching'!
includesMatchCharacters
@@ -3950,8 +3946,6 @@
! !
-
-
!CharacterArray methodsFor:'matching - glob expressions'!
compoundMatch:aString
@@ -4396,7 +4390,6 @@
! !
-
!CharacterArray methodsFor:'padded copying'!
centerPaddedTo:newSize
@@ -4921,7 +4914,6 @@
"Modified: 17.4.1997 / 12:50:23 / cg"
! !
-
!CharacterArray methodsFor:'special string converting'!
expandPlaceholders:escapeCharacter with:argArrayOrDictionary
@@ -4968,7 +4960,8 @@
dict at:$a put:'AAAAA'.
dict at:$b put:[ Time now ].
dict at:'foo' put:[ Date today ].
- 'hello $1 %a $b %(foo)' expandPlaceholders:$$ with:dict
+ 'hello $1 %a $b %(foo) $foo ' expandPlaceholders:$$ with:dict.
+ 'hello $1 %a $b %(foo) $foo ' expandPlaceholders:$% with:dict.
"
"Modified: 1.7.1997 / 00:53:24 / cg"
@@ -5864,7 +5857,6 @@
"
! !
-
!CharacterArray methodsFor:'substring searching'!
findRangeOfString:subString
@@ -6088,6 +6080,36 @@
"
"Created: 25.11.1995 / 11:04:18 / cg"
+!
+
+splitAtString:subString withoutSeparators:strip
+ "If the receiver is of the form:
+ <left><subString><right>
+ return a collection containing left and right only.
+ If strip is true, remove whiteSpace in the returned substrings."
+
+ |idx left right|
+
+ (idx := self indexOfSubCollection:subString) ~~ 0 ifTrue:[
+ left := self copyTo:(idx - 1).
+ right := self copyFrom:(idx + subString size).
+ strip ifTrue:[
+ left := left withoutSeparators.
+ right := right withoutSeparators.
+ ].
+ ^ StringCollection with:left with:right
+ ].
+ self error:'substring not present in receiver' mayProceed:true.
+ ^ self
+
+ "
+ 'hello -> world' splitAtString:'->' withoutSeparators:false
+ 'hello -> world' splitAtString:'->' withoutSeparators:true
+ 'hello -> ' splitAtString:'->' withoutSeparators:true
+ 'hello > error' splitAtString:'->' withoutSeparators:true
+ "
+
+ "Created: 25.11.1995 / 11:04:18 / cg"
! !
!CharacterArray methodsFor:'testing'!
@@ -6386,11 +6408,11 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.500 2013-04-25 13:12:04 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.502 2013-05-06 09:55:08 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.500 2013-04-25 13:12:04 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.502 2013-05-06 09:55:08 cg Exp $'
! !