--- a/CharacterArray.st Sat May 08 15:25:13 1999 +0200
+++ b/CharacterArray.st Sat May 08 16:32:08 1999 +0200
@@ -4729,6 +4729,7 @@
withoutSeparators
"return a copy of myself without leading and trailing whitespace.
+ (but whiteSpace in-between is preserved)
Whitespace is space, tab, newline, formfeed.
Use withoutSpaces, if you want to remove spaces only."
@@ -4741,16 +4742,16 @@
endIndex := sz.
[(startIndex < endIndex) and:[(self at:startIndex) isSeparator]] whileTrue:[
- startIndex := startIndex + 1
+ startIndex := startIndex + 1
].
[(endIndex > 1) and:[(self at:endIndex) isSeparator]] whileTrue:[
- endIndex := endIndex - 1
+ endIndex := endIndex - 1
].
startIndex > endIndex ifTrue:[
- ^ ''
+ ^ ''
].
((startIndex == 1) and:[endIndex == sz]) ifTrue:[
- ^ self
+ ^ self
].
^ self copyFrom:startIndex to:endIndex
@@ -4765,6 +4766,7 @@
withoutSpaces
"return a copy of myself without leading and trailing spaces.
+ (but spaces in-between are preserved)
Notice: this does NOT remove tabs, newline or any other whitespace.
Use withoutSeparators for this."
@@ -4777,16 +4779,16 @@
endIndex := sz.
[(startIndex < endIndex) and:[(self at:startIndex) == Character space]] whileTrue:[
- startIndex := startIndex + 1
+ startIndex := startIndex + 1
].
[(endIndex > 1) and:[(self at:endIndex) == Character space]] whileTrue:[
- endIndex := endIndex - 1
+ endIndex := endIndex - 1
].
startIndex > endIndex ifTrue:[
- ^ ''
+ ^ ''
].
((startIndex == 1) and:[endIndex == sz]) ifTrue:[
- ^ self
+ ^ self
].
^ self copyFrom:startIndex to:endIndex
@@ -4795,6 +4797,7 @@
'foo ' withoutSpaces
' foo' withoutSpaces
' ' withoutSpaces
+ 'a b' withoutSpaces
(' foo' , Character tab asString , ' ') withoutSpaces inspect
"
!
@@ -5291,6 +5294,6 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.158 1999-04-23 10:40:44 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.159 1999-05-08 14:32:08 cg Exp $'
! !
CharacterArray initialize!