CharacterArray.st
changeset 9190 87dd824f1ebb
parent 9151 ed9ab63d9b42
child 9191 7f1797f8d0a3
--- a/CharacterArray.st	Thu Feb 23 18:54:08 2006 +0100
+++ b/CharacterArray.st	Thu Feb 23 18:54:32 2006 +0100
@@ -566,54 +566,7 @@
     "
 
     "Modified: 2.4.1997 / 16:20:29 / cg"
-! !
-
-!CharacterArray class methodsFor:'queries'!
-
-isAbstract
-    ^ self == CharacterArray
-! !
-
-!CharacterArray methodsFor:'Compatibility-ANSI'!
-
-addLineDelimiters
-    "Ansi compatibility - same as withCRs"
-
-    ^ self withCRs
-
-    "Modified: / 13.11.2001 / 19:16:25 / cg"
-! !
-
-!CharacterArray methodsFor:'Compatibility-Dolphin'!
-
-argumentCount
-    "same as #numArgs - return the number of arguments a message with myself
-     as selector would take."
-
-    ^  self numArgs
-!
-
-copyExpanding:expandTable
-    "return a copy of myself, with translations from the expandTable sliced in.
-     The argument is supposed to map from characters to either characters or strings."
-
-    |ds|
-
-    ds := WriteStream on:(self species new).
-    self do:[:eachChar |
-	|repl|
-
-	repl := expandTable at:eachChar ifAbsent:nil.
-	repl isNil ifTrue:[
-	    ds nextPut:eachChar
-	] ifFalse:[
-	    repl size == 0 ifTrue:[
-		ds nextPut:repl
-	    ] ifFalse:[
-		ds nextPutAll:repl
-	    ]
-	].
-    ].
+ ].
     ^ ds contents.
 !
 
@@ -640,6 +593,33 @@
 formatWith:arg1 with:arg2 with:arg3
     "same as #bindWith: for dolphin compatibility"
 
+    ^ self bindWitcopyExpanding:expandTable
+    "return a copy of myself, with translations from the expandTable sliced in.
+     The argument is supposed to map from characters to either characters or strings."
+
+    |ds|
+
+    ds := WriteStream on:(self species new).
+    self do:[:eachChar |
+	|repl|
+
+	repl := expandTable at:eachChar ifAbsent:nil.
+	repl isNil ifTrue:[
+	    ds nextPut:eachChar
+	] ifFalse:[
+	    repl size == 0 ifTrue:[
+		ds nextPut:repl
+	    ] ifFalse:[
+		ds nextPutAll:repl
+	    ]
+	].
+    ].
+    ^ ds contents.
+!
+
+formatWith:arg1 with:arg2 with:arg3
+    "same as #bindWith: for dolphin compatibility"
+
     ^ self bindWith:arg1 with:arg2 with:arg3
 
     "
@@ -651,22 +631,17 @@
 
 byteAt:index put:aByte
     "store a byte at given index.
+ 
+
+byteAt:index put:aByte
+    "store a byte at given index.
      This is an ST/V compatibility method."
 
 "/    (aByte == 0) ifTrue:[
 "/        "store a space instead"
 "/        ^ super basicAt:index put:(Character space)
 "/    ].
-    ^ super at:index put:(Character value:aByte)
-
-    "
-     'hello' copy at:1 put:$H asciiValue; yourself
-     'hello' copy byteAt:1 put:72; yourself
-     'hello' copy byteAt:1 put:0; yourself
-    "
-
-    "Modified: 6.5.1996 / 10:35:26 / cg"
-!
+    ^ super at:index put:(C
 
 replChar:oldChar with:newChar
     "return a copy of the receiver, with all oldChars replaced
@@ -684,6 +659,17 @@
 
 replChar:oldChar withString:newString
     "return a copy of the receiver, with all oldChars replaced
+     by newString (i.e. slice in the newStplChar:$0 withString:'foo'
+     'a string with spaces' replChar:$  withString:' foo '
+    "
+!
+
+replString:subString withString:newString
+    "return a copy of the receiver, with all sequences of subString replaced
+     by newString (i.e. slice in the newString in place of the oldString)."
+
+    ^ self coreplChar:oldChar withString:newString
+    "return a copy of the receiver, with all oldChars replaced
      by newString (i.e. slice in the newString in place of the oldChar).
      This is an ST/V compatibility method."
 
@@ -703,9 +689,7 @@
      '12345678901234567890' replChar:$0 withString:'foo'
      'a string with spaces' replChar:$  withString:' foo '
     "
-!
-
-replString:subString withString:newString
+ithStreplString:subString withString:newString
     "return a copy of the receiver, with all sequences of subString replaced
      by newString (i.e. slice in the newString in place of the oldString)."
 
@@ -721,24 +705,7 @@
     "
 
     "Modified: / 12-05-2004 / 12:00:27 / cg"
-!
-
-trimBlanks
-    "return a copy of the receiver without leading
-     and trailing spaces.
-     This is an ST/V compatibility method."
-
-    ^ self withoutSpaces
-
-    "
-     '    spaces at beginning' trimBlanks
-     'spaces at end    ' trimBlanks
-     '    spaces at beginning and end     ' trimBlanks
-     'no spaces' trimBlanks
-    "
-! !
-
-!CharacterArray methodsFor:'Compatibility-Squeak'!
+
 
 asDate
     "Many allowed forms, see Date.readFrom:"
@@ -764,6 +731,10 @@
 
 displayProgressAt:aPointOrNil from:start to:stop during:aBlock
      ProgressIndicator
+	displayProgress:se
+
+displayProgressAt:aPointOrNil from:start to:stop during:aBlock
+     ProgressIndicator
 	displayProgress:self
 	at:aPointOrNil
 	from:start
@@ -774,34 +745,7 @@
      'dobedobedoobedoo'
 	displayProgressAt:(Screen current center)
 	from:0 to:100
-	during:[:val |
-		0 to:100 do:[:i |
-		    val value:i.
-		    Delay waitForSeconds:0.05.
-		]
-	       ]
-    "
-!
-
-endsWithDigit
-    "Answer whether the receiver's final character represents a digit.  3/11/96 sw"
-
-    ^ self size > 0 and: [self last isDigit]
-!
-
-findDelimiters:delimiters startingAt:start 
-    "Answer the index of the character within the receiver, starting at start, that matches one of the delimiters. If the receiver does not contain any of the delimiters, answer size + 1."
-
-    |idx|
-
-    idx := self indexOfAny:delimiters startingAt:start.
-    idx == 0 ifTrue:[^ self size + 1].
-    ^ idx.
-"/start to: self size do: [:i |
-"/        |char|
-"/
-"/        char := self at: i.
-"/        delimiters do: [:delim | delim = char ifTrue: [^ i]]
+	duri
 "/    ].
 "/    ^ self size + 1
 !
@@ -824,34 +768,52 @@
 
     "
      'hello world' includesSubString:'Hel'
-     'hello world' includesSubString:'hel'
-     'hello world' includesSubString:'llo'
-    "
-
-
+     'hello world' incfindDelimiters:delimiters startingAt:start 
+    "Answer the index of the character within the receiver, starting at start, that matches one of the delimiters. If the receiver does not contain any of the delimiters, answer size + 1."
+
+    |idx|
+
+    idx := self indexOfAny:delimiters startingAt:start.
+    idx == 0 ifTrue:[^ self size + 1].
+    ^ idx.
+"/start to: self size do: [:i |
+"/        |char|
+"/
+"/        char := self at: i.
+"/        delimiters do: [:delim | delim = char ifTrue: [^ i]]
+"/    ].
+"/    ^ self size + 1
+
+
+includesSubString:aString
+    "return true, if a substring is contained in the receiver.
+     The compare is case sensitive."
+
+    ^ self includesString:aString
+
+    "
+     'hello world' includesSubString:'Hel'
+     '
 
 !
 
-includesSubstring:aString caseSensitive:caseSensitive
-    "return true, if a substring is contained in the receiver.
-     The argument, caseSensitive controls if case is ignored in the compare."
-
-    "/ for now,  a q&d hack ...
-
-    caseSensitive ifFalse:[
-	^ self asLowercase includesString:aString asLowercase
-    ].
-    ^ self includesString:aString
-
-    "
-     'hello world' includesSubstring:'Hel' caseSensitive:true
-     'hello world' includesSubstring:'Hel' caseSensitive:false
-    "
-
-
-
+isAllDigits
+    "Answer whether the receiver's characters are all digits"
+
+    ^ self conform:[:eachChar | eachChar isDigit]
+
+    "
+     'hello world' isAllDigits
+     '12344' isAllDigits
+    "
 !
 
+lastSpacePosition
+    ^ self lastIndexOfSeparator
+!
+
+padded:leftOrRight to:paddedSize with
+
 isAllDigits
     "Answer whether the receiver's characters are all digits"
 
@@ -874,12 +836,32 @@
     ^ self paddedTo:paddedSize with:padCharacter
 
     "
+     'hello' padded:#righ
+
+padded:leftOrRight to:paddedSize with:padCharacter
+    leftOrRight == #left ifTrue:[
+	^ self leftPaddedTo:paddedSize with:padCharacter
+    ].
+    ^ self paddedTo:paddedSize with:padCharacter
+
+    "
      'hello' padded:#right to:10 with:$.
-     'hello' padded:#left to:10 with:$.
+   ***7890' skipDelimiters:'*' startingAt:3
+     '123***7890' skipDelimiters:'*' startingAt:10
+     '123*******' skipDelimiters:'*' startingAt:10
     "
 !
 
-skipDelimiters:delimiters startingAt:start
+substrings
+    ^ self asCollectionOfWords
+
+    "
+     'foo bar baz' substrings
+    "
+!
+
+truncateTo:smallSize
+    "return myskipDelimiters:delimiters startingAt:start
     "Answer the index of the character within the receiver, starting at start,
      that does NOT match one of the delimiters.
      If the receiver does not contain any of the delimiters, answer size + 1.
@@ -896,30 +878,7 @@
      '123***7890' skipDelimiters:'*' startingAt:10
      '123*******' skipDelimiters:'*' startingAt:10
     "
-!
-
-substrings
-    ^ self asCollectionOfWords
-
-    "
-     'foo bar baz' substrings
-    "
-!
-
-truncateTo:smallSize
-    "return myself or a copy shortened to smallSize.  1/18/96 sw"
-
-    self size <= smallSize ifTrue:[^ self].
-    ^ self copyFrom: 1 to: smallSize
-
-    "
-     'hello world' truncateTo:5
-     'hello' truncateTo:10
-
-     'hello world' copyTo:5
-     'hello' copyTo:10
-    "
-!
+
 
 withBlanksTrimmed
     "Return a copy of the receiver from which leading and trailing blanks have been trimmed."
@@ -937,6 +896,19 @@
 withNoLineLongerThan: aNumber
     "Answer a string with the same content as receiver, but rewrapped so that no line has more characters than the given number"
 
+    | list    "
+
+
+
+! !
+
+!CharacterArray methodsFor:'Compatibility-V''Age'!
+
+addLineDelimiter
+    "replace all '\'-characters by line delimiter (cr) - characters.
+     This has been added for VisualAge compwithNoLineLongerThan: aNumber
+    "Answer a string with the same content as receiver, but rewrapped so that no line has more characters than the given number"
+
     | listOfLines currentLast currentStart resultString putativeLast putativeLine crPosition |
 
     aNumber isNumber not | (aNumber < 1) ifTrue: [self error: 'too narrow'].
@@ -974,26 +946,7 @@
 
 ! !
 
-!CharacterArray methodsFor:'Compatibility-V''Age'!
-
-addLineDelimiter
-    "replace all '\'-characters by line delimiter (cr) - characters.
-     This has been added for VisualAge compatibility."
-
-    ^ self withCRs
-!
-
-bindWith:aString
-    "return a copy of the receiver, where a '%1' escape is
-     replaced by aString.
-     This has been added for VisualAge compatibility."
-
-    ^ self expandPlaceholdersWith:(Array with:aString)
-
-    "
-     'do you like %1 ?' bindWith:'smalltalk'
-    "
-!
+!CharacterArray
 
 bindWith:string1 with:string2
     "return a copy of the receiver, where a '%1' escape is
@@ -1009,6 +962,9 @@
 !
 
 bindWith:str1 with:str2 with:str3
+    "return a copy of the receiver, where a '%1', '%2' and '%3' escape
+
+bindWith:str1 with:str2 with:str3
     "return a copy of the receiver, where a '%1', '%2' and '%3' escapes
      are replaced by str1, str2 and str3 respectively.
      This has been added for VisualAge compatibility."
@@ -1016,10 +972,7 @@
     ^ self expandPlaceholdersWith:(Array with:str1 with:str2 with:str3)
 
     "
-     'do you prefer %1 or rather %2 (not talking about %3) ?'
-	bindWith:'smalltalk' with:'c++' with:'c'
-    "
-!
+     'do you prefer %1 or rather %2 (not talking abou
 
 bindWith:str1 with:str2 with:str3 with:str4
     "return a copy of the receiver, where a '%1', '%2', '%3' and '%4' escapes
@@ -1029,10 +982,7 @@
     ^ self expandPlaceholdersWith:(Array with:str1 with:str2 with:str3 with:str4)
 
     "
-     'do you prefer %1 or rather %2 (not talking about %3 or even %4) ?'
-	bindWith:'smalltalk' with:'c++' with:'c' with:'assembler'
-    "
-!
+     'do you prefer %1 or rather %2 (not talking about %3 or even %4) ?
 
 bindWith:str1 with:str2 with:str3 with:str4 with:str5
     "return a copy of the receiver, where a '%1' .. '%5' escapes
@@ -1045,6 +995,9 @@
 !
 
 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6
+    "return a copy of the receiv
+
+bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6
     "return a copy of the receiver, where a '%1' .. '%6' escapes
      are replaced by str1 .. str5 respectively.
      This has been added for VisualAge compatibility."
@@ -1061,13 +1014,7 @@
      'i' may be between 1 and 9 (i.e. a maximum of 9 placeholders is allowed).
      This has been added for VisualAge compatibility."
 
-    ^ self expandPlaceholdersWith:anArrayOfStrings
-
-    "
-     'do you prefer %1 or rather %2 (not talking about %3) ?'
-	bindWithArguments:#('smalltalk' 'c++' 'c')
-    "
-!
+    ^ self expandPlaceholdersWith:anArrayOfStrin
 
 subStrings
     "return an array consisting of all words contained in the receiver.
@@ -1084,22 +1031,14 @@
 subStrings:separatorCharacter
     "return an array consisting of all words contained in the receiver.
      Words are separated by separatorCharacter.
+     This has been added f
+
+subStrings:separatorCharacter
+    "return an array consisting of all words contained in the receiver.
+     Words are separated by separatorCharacter.
      This has been added for VisualAge compatibility."
 
-    ^ self asCollectionOfSubstringsSeparatedBy:separatorCharacter
-
-    "
-     'foo:bar:baz:smalltalk' subStrings:$:
-    "
-!
-
-trimSeparators
-    "return a copy of the receiver without leading and trailing whiteSpace"
-
-    ^ self withoutSeparators
-! !
-
-!CharacterArray methodsFor:'Compatibility-VW'!
+    ^ self asCollectionOfSubstringsSeparatedBy:separatorCharac
 
 asLogicalFileSpecification
     ^ self asFilename
@@ -1124,20 +1063,25 @@
      'hello<n>foo' expandMacros
     "
 
-    "Modified: / 18.6.1998 / 16:03:02 / cg"
-!
-
-expandMacrosWith:arg
+    "Modified: / 18.
+
+expandMacros
+    "ST80 compatibility - expand '<..>' macros with
+     argument strings. Similar to #bindWith:.
+     Read the comment in #expandMacrosWithArguments: aboexpandMacros
     "ST80 compatibility - expand '<..>' macros with
      argument strings. Similar to #bindWith:.
      Read the comment in #expandMacrosWithArguments: about
      limited compatibility issues."
 
-    ^ self expandMacrosWithArguments:(Array with:arg)
-
-    "Created: / 1.11.1997 / 13:01:28 / cg"
-    "Modified: / 1.11.1997 / 13:30:50 / cg"
-!
+    ^ self expandMacrosWithArguments:#()
+
+    "
+     'hello<n>foo' expandMacros
+    "
+
+    "Modified: / 18.6.1998 / 16:03:02 / cg"
+
 
 expandMacrosWith:arg1 with:arg2
     "ST80 compatibility - expand '<..>' macros with
@@ -1150,6 +1094,8 @@
     "Modified: / 6.7.1998 / 21:58:14 / cg"
 !
 
+expandMacrosWi
+
 expandMacrosWith:arg1 with:arg2 with:arg3
     "ST80 compatibility - expand '<..>' macros with
      argument strings. Similar to #bindWith:.
@@ -1159,7 +1105,25 @@
     ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2 with:arg3)
 !
 
-expandMacrosWithArguments:argArray
+expandMacrosW:46 / cg"
+!
+
+isCharacters
+    "added for visual works compatibility"
+    ^ true
+! !
+
+!CharacterArray methodsFor:'JavaScript support'!
+
++ aStringOrCharacter
+    "alternative string-concatenation.
+     For JavaScript only"
+
+    ^ self , aStringOrCharacter
+
+    "
+     'hello' + $1  
+     'hello' + '1expandMacrosWithArguments:argArray
     "ST80 compatibility - expand '<..>' macros with
      argument strings. Similar to #bindWith:.
      WARNING: possibly not all ST80 expansions are supported here."
@@ -1277,30 +1241,25 @@
     "
 
     "Modified: / 18.6.1998 / 16:04:46 / cg"
+o\' includesMatchCharacters
+    "
+
+    "Modified: 2.4.1997 / 18:12:34 / cg"
 !
 
-isCharacters
-    "added for visual works compatibility"
-    ^ true
-! !
-
-!CharacterArray methodsFor:'JavaScript support'!
-
-+ aStringOrCharacter
-    "alternative string-concatenation.
-     For JavaScript only"
-
-    ^ self , aStringOrCharacter
-
-    "
-     'hello' + $1  
-     'hello' + '1' 
-    "
-! !
-
-!CharacterArray methodsFor:'character searching'!
-
-includesMatchCharacters
+includesSeparator
+    "return true, if the receiver contains any whitespace characters"
+
+    ^ (self indexOfSeparator ~~ 0)
+
+    "
+     'hello world' includesSeparator
+     'helloworld' includesSeparator
+    "
+!
+
+includesUnescapedMatchCharacters
+    "return true if includesMatchCharacters
     "return true if the receiver includes any meta characters (i.e. $* or $#)
      for match operations; false if not.
      Here, do not care for $\ escapes"
@@ -1319,20 +1278,16 @@
     "
 
     "Modified: 2.4.1997 / 18:12:34 / cg"
+esUnescapedMatchCharacters
+     'foo\' includesUnescapedMatchCharacters
+    "
+
+    "Modified: 2.4.1997 / 17:08:52 / cg"
+    "Created: 2.4.1997 / 17:23:26 / cg"
 !
 
-includesSeparator
-    "return true, if the receiver contains any whitespace characters"
-
-    ^ (self indexOfSeparator ~~ 0)
-
-    "
-     'hello world' includesSeparator
-     'helloworld' includesSeparator
-    "
-!
-
-includesUnescapedMatchCharacters
+indexOfControlCharacterStartingAt:startIndex
+   includesUnescapedMatchCharacters
     "return true if the receiver really includes any meta characters (i.e. $* or $#)
      for match operations; false if not.
      Here, care for $\ escapes"
@@ -1369,32 +1324,14 @@
 
     "Modified: 2.4.1997 / 17:08:52 / cg"
     "Created: 2.4.1997 / 17:23:26 / cg"
-!
-
-indexOfControlCharacterStartingAt:startIndex
+ld' aindexOfControlCharacterStartingAt:startIndex
     "return the index of the next control character;
      starting the search at startIndex, searching forward;
      that is a character with asciiValue < 32.
      Return 0 if none is found."
 
     |start  "{ Class: SmallInteger }"
-     mySize "{ Class: SmallInteger }"|
-
-    start := startIndex.
-    mySize := self size.
-
-    start to:mySize do:[:index |
-	(self at:index) isControlCharacter ifTrue:[^ index]
-    ].
-    ^ 0
-
-    "
-     'hello world' asTwoByteString            indexOfControlCharacterStartingAt:1
-     'hello world\foo' withCRsasTwoByteString indexOfControlCharacterStartingAt:1
-    "
-
-    "Modified: / 21.7.1998 / 17:25:07 / cg"
-!
+     mySize "{ Class: SmallInteger }
 
 indexOfNonSeparator
     "return the index of the first non-whitespace character.
@@ -1408,11 +1345,22 @@
      'a   ' indexOfNonSeparator
      'abc' indexOfNonSeparator
      ' ' indexOfNonSeparator
-     '' indexOfNonSeparator
+     '' indexOfNonSepa
+     '    ' indexOfNonSeparatorStartingAt:1
+     'a   ' indexOfNonSeparatorStartingAt:2
+    "
+
+    "
+     |s index1 index2|
+     s := '   foo    bar      baz'.
+     index1 := s indexOfNonSeparatorStartingAt:1.
+     index2 := s indexOfSeparatorStartingAt:index1.
+     s copyFrom:index1 to:index2 - 1
     "
 !
 
-indexOfNonSeparatorStartingAt:startIndex
+indexOfSeparator
+    "return the index of the first whitespaindexOfNonSeparatorStartingAt:startIndex
     "return the index of the next non-whitespace character,
      starting the search at startIndex, searching forward;
      return 0 if no non-separator was found"
@@ -1441,42 +1389,7 @@
      index2 := s indexOfSeparatorStartingAt:index1.
      s copyFrom:index1 to:index2 - 1
     "
-!
-
-indexOfSeparator
-    "return the index of the first whitespace character;
-     starting the search at the beginning, searching forward;
-     return 0 if no separator was found"
-
-    ^ self indexOfSeparatorStartingAt:1
-
-    "
-     'hello world' indexOfSeparator
-     'helloworld' indexOfSeparator
-     'hello   ' indexOfSeparator
-     '   hello' indexOfSeparator
-    "
-!
-
-indexOfSeparatorStartingAt:startIndex
-    "return the index of the next whitespace character,
-     starting the search at startIndex, searching forward;
-     return 0 if no separator was found"
-
-    |start  "{ Class: SmallInteger }"
-     mySize "{ Class: SmallInteger }"|
-
-    start := startIndex.
-    mySize := self size.
-
-    start to:mySize do:[:index |
-	(self at:index) isSeparator ifTrue:[^ index]
-    ].
-    ^ 0
-
-    "
-     'hello world' indexOfSeparatorStartingAt:3
-     ' hello world' indexOfSeparatorStartingAt:3
+d' indexOfSeparatorStartingAt:3
      'hello world ' indexOfSeparatorStartingAt:3
      'hello world ' indexOfSeparatorStartingAt:6
      'hello world ' indexOfSeparatorStartingAt:7
@@ -1487,6 +1400,16 @@
 
 lastIndexOfSeparator
     "return the last index of the whitespace character.
+     (iindexOfSeparatorStartingAt:startIndex
+    "return the index of the next whitespace character,
+     starting the search at startIndex, searching forward;
+     return 0 if no separator was found"
+
+    |start  "{ Class: SmallInteger }"
+     mySize "{ Class: SmallInteger }
+
+lastIndexOfSeparator
+    "return the last index of the whitespace character.
      (i.e. start the search at the end and search backwards);
      Returns 0 if no separator is found."
 
@@ -1501,23 +1424,7 @@
 !
 
 lastIndexOfSeparatorStartingAt:startIndex
-    "return the index of the previous whitespace character,
-     starting the search at startIndex (and searching backwards);
-     returns 0 if no separator was found"
-
-    |start  "{ Class: SmallInteger }"|
-
-    start := startIndex.
-
-    start to:1 by:-1 do:[:index |
-	(self at:index) isSeparator ifTrue:[^ index]
-    ].
-    ^ 0
-
-    "
-     'hello world' lastIndexOfSeparatorStartingAt:3
-     'hello world' lastIndexOfSeparatorStartingAt:7
-     'helloworld' lastIndexOfSeparatorStartingAt:7
+    "return the index of the previlloworld' lastIndexOfSeparatorStartingAt:7
      ' helloworld' lastIndexOfSeparatorStartingAt:7
     "
 ! !
@@ -1528,15 +1435,12 @@
     "Compare the receiver with the argument and return true if the
      receiver is greater than the argument. Otherwise return false.
      This comparison is based on the elements ascii code -
-     i.e. upper/lowercase & upper/lowercase & national characters are NOT treated specially."
-
-    |mySize    "{ Class: SmallInteger }"
-     otherSize "{ Class: SmallInteger }"
-     n         "{ Class: SmallInteger }"
-     c1 c2|
-
-    mySize := self size.
-    otherSize := aString string size.
+     i.e. upper/lowercase & upper/lowercase & natilastIndexOfSeparatorStartingAt:startIndex
+    "return the index of the previous whitespace character,
+     starting the search at startIndex (and searching backwards);
+     returns 0 if no separator was found"
+
+    |start  "{ Class: SmallInteger }.
     n := mySize min:otherSize.
 
     1 to:n do:[:index |
@@ -1551,6 +1455,30 @@
     "Compare the receiver with the argument and return true if the
      receiver is equal to the argument. Otherwise return false.
 
+     This compare does NOT ignore case differences,
< aString
+    "Compare the receiver with the argument and return true if the
+     receiver is greater than the argument. Otherwise return false.
+     This comparison is based on the elements ascii code -
+     i.e. upper/lowercase & upper/lowercase & national characters are NOT treated specially."
+
+    |mySize    "{ Class: SmallInteger }"
+     otherSize "{ Class: SmallInteger }"
+     n         "{ Class: SmallInteger }  otherSize := aString size.
+    mySize == otherSize ifFalse:[^ false].
+
+    1 to:mySize do:[:index |
+	(self at:index) = (aString at:index) ifFalse:[^ false].
+    ].
+    ^ true
+
+    "
+     'foo' = 'Foo'
+     'foo' = 'bar'
+     'foo' = 'foo'
+     'foo' = aString
+    "Compare the receiver with the argument and return true if the
+     receiver is equal to the argument. Otherwise return false.
+
      This compare does NOT ignore case differences,
      therefore 'foo' = 'Foo' will return false.
      Since this is incompatible to ST-80 (at least, V2.x) , this may change."
@@ -1581,8 +1509,7 @@
 
     "Modified: 22.4.1996 / 15:53:58 / cg"
 !
-
-> aString
+.
> aString
     "Compare the receiver with the argument and return true if the
      receiver is greater than the argument. Otherwise return false.
      This comparison is based on the elements ascii code -
@@ -1590,37 +1517,7 @@
 
     |mySize    "{ Class: SmallInteger }"
      otherSize "{ Class: SmallInteger }"
-     n         "{ Class: SmallInteger }"
-     c1 c2|
-
-    mySize := self size.
-    otherSize := aString string size.
-    n := mySize min:otherSize.
-
-    1 to:n do:[:index |
-	c1 := self at:index.
-	c2 := aString at:index.
-	(c1 == c2 or:[c1 = c2]) ifFalse:[^ c1 > c2].
-    ].
-    ^ mySize > otherSize
-
-    "Modified: 22.4.1996 / 15:55:00 / cg"
-!
-
-compareCaselessWith:aString
-    "Compare the receiver against the argument, ignoreing case.
-     Return 1 if the receiver is greater, 0 if equal and -1 if less than the argument.
-
-     This comparison is based on the elements ascii code -
-     i.e. national characters are NOT treated specially.
-     'foo' compareWith: 'Foo' will return 0"
-
-    |mySize    "{ Class: SmallInteger }"
-     otherSize "{ Class: SmallInteger }"
-     n         "{ Class: SmallInteger }"
-     c1 c2|
-
-    mySize := self size.
+     n         "{ Class: SmallInteger }f size.
     otherSize := aString string size.
     n := mySize min:otherSize.
 
@@ -1631,23 +1528,17 @@
 	c1 < c2 ifTrue:[^ -1].
     ].
     mySize > otherSize ifTrue:[^ 1].
-    mySize < otherSize ifTrue:[^ -1].
-    ^ 0
-
-    "Modified: 22.4.1996 / 15:56:07 / cg"
-!
-
-compareWith:aString
-    "Compare the receiver with the argument and return 1 if the receiver is
-     greater, 0 if equal and -1 if less than the argument.
+    mySize < otherSize ifTrucompareCaselessWith:aString
+    "Compare the receiver against the argument, ignoreing case.
+     Return 1 if the receiver is greater, 0 if equal and -1 if less than the argument.
+
      This comparison is based on the elements ascii code -
-     i.e. upper/lowercase & national characters are NOT treated specially.
-     'foo' compareWith: 'Foo' will return 1.
-     while 'foo' sameAs:'Foo' will return true"
+     i.e. national characters are NOT treated specially.
+     'foo' compareWith: 'Foo' will return 0"
 
     |mySize    "{ Class: SmallInteger }"
      otherSize "{ Class: SmallInteger }"
-     n         "{ Class: SmallInteger }"
+     n         "{ Class: SmallInteger }eger }"
      c1 c2|
 
     mySize := self size.
@@ -1667,7 +1558,32 @@
     "Modified: 22.4.1996 / 15:56:07 / cg"
 !
 
-hash
+hashcompareWith:aString
+    "Compare the receiver with the argument and return 1 if the receiver is
+     greater, 0 if equal and -1 if less than the argument.
+     This comparison is based on the elements ascii code -
+     i.e. upper/lowercase & national characters are NOT treated specially.
+     'foo' compareWith: 'Foo' will return 1.
+     while 'foo' sameAs:'Foo' will return true"
+
+    |mySize    "{ Class: SmallInteger }"
+     otherSize "{ Class: SmallInteger }"
+     n         "{ Class: SmallInteger }This speeds up Set and Dictionary by a factor of 10!
+     */
+    val *= 31415821;
+    RETURN ( __mkSmallInteger(val & 0x3fffffff));
+%}
+
+!
+
+sameAs:aString
+    "Compare the receiver with the argument like =, but ignore case differences.
+     Return true or false."
+
+    |mySize "{ Class: SmallInteger }"
+     otherSize c1 c2|
+
+    self == aString ifTruehash
     "return an integer useful as a hash-key"
 
 %{  /* NOCONTEXT */
@@ -1721,43 +1637,15 @@
     /*
      * multiply by large prime to spread values
      * This speeds up Set and Dictionary by a factor of 10!
-     */
-    val *= 31415821;
-    RETURN ( __mkSmallInteger(val & 0x3fffffff));
-%}
-
-!
-
-sameAs:aString
-    "Compare the receiver with the argument like =, but ignore case differences.
-     Return true or false."
-
-    |mySize "{ Class: SmallInteger }"
-     otherSize c1 c2|
-
-    self == aString ifTrue:[^ true].
-
-    mySize := self size.
-    otherSize := aString string size.
-    mySize == otherSize ifFalse:[^ false].
-
-    1 to:mySize do:[:index |
-	c1 := self at:index.
-	c2 := aString at:index.
-	c1 == c2 ifFalse:[
-	    (c1 sameAs:c2) ifFalse:[^ false].
-	]
-    ].
-    ^ true
-
     "
      'foo' sameAs: 'Foo'
      'foo' sameAs: 'bar'
      'foo' sameAs: 'foo'
-    "
-
-    "Modified: 22.4.1996 / 15:56:17 / cg"
-!
+  sameAs:aString
+    "Compare the receiver with the argument like =, but ignore case differences.
+     Return true or false."
+
+    |mySize "{ Class: SmallInteger }
 
 sameAs:aString ignoreCase:ignoreCase
     "Compare the receiver with the argument.
@@ -1777,28 +1665,7 @@
 !
 
 sameCharacters:aString
-    "count & return the number of characters which are the same
-     (ignoring case and emphasis) in the receiver and the argument, aString."
-
-    |n "{ Class: SmallInteger }"
-     c1 c2 cnt|
-
-    n := self size.
-    n := n min:(aString string size).
-
-    cnt := 0.
-    1 to:n do:[:index |
-	c1 := self at:index.
-	c2 := aString at:index.
-	((c1 == c2)
-	or:[c1 asLowercase = c2 asLowercase]) ifTrue:[
-	    cnt := cnt + 1
-	]
-    ].
-    ^ cnt
-
-    "
-     'foobarbaz' sameCharacters: 'foo'
+    "count & return the number of characters which are the sameameCharacters: 'foo'
      'foobarbaz' sameCharacters: 'Foo'
      'foobarbaz' sameCharacters: 'baz'
     "
@@ -1812,15 +1679,36 @@
     "
      'hello' asText sameEmphasisAs: 'hello'
      'hello' asText sameEmphasisAs: 'hello' asText
+  sameCharacters:aString
+    "count & return the number of characters which are the same
+     (ignoring case and emphasis) in the receiver and the argument, aString."
+
+    |n "{ Class: SmallInteger }
+
+sameEmphasisAs:aStringOrText
+    "compare the receivers and the arguments emphasis"
+
+    ^ self emphasis = aStringOrText emphasis
+
+    "
+     'hello' asText sameEmphasisAs: 'hello'
+     'hello' asText sameEmphasisAs: 'hello' asText
      'hello' asText allBold sameEmphasisAs: 'hello'
      'hello' asText allBold sameEmphasisAs: 'fooba' asText allBold
-     'hello' asText allBold sameEmphasisAs: 'fooba' asText allItalic
-    "
-
-
-!
-
-sameStringAndEmphasisAs:aStringOrText
+     'hello' asText allBold sameEm 'fooba' asText allBold
+     'hello' sameStringAndEmphasisAs: 'fooba' asText allItalic
+    "
+! !
+
+!CharacterArray methodsFor:'converting'!
+
+asArrayOfSubstrings
+    "return an array of substrings from the receiver, interpreting
+     separators (i.e. spaces & newlines) as word-delimiters.
+     This is a compatibility method - the actual work is done in
+     asCollectionOfWords."
+
+    ^ self asCollectionOfWords asArray
sameStringAndEmphasisAs:aStringOrText
     "compare both emphasis and string of the receiver and the argument"
 
     aStringOrText isString ifFalse:[^ false].
@@ -1855,25 +1743,7 @@
      'hello' sameStringAndEmphasisAs: 'fooba' asText allBold
      'hello' sameStringAndEmphasisAs: 'fooba' asText allItalic
     "
-! !
-
-!CharacterArray methodsFor:'converting'!
-
-asArrayOfSubstrings
-    "return an array of substrings from the receiver, interpreting
-     separators (i.e. spaces & newlines) as word-delimiters.
-     This is a compatibility method - the actual work is done in
-     asCollectionOfWords."
-
-    ^ self asCollectionOfWords asArray
-
-    "
-     '1 one two three four 5 five' asArrayOfSubstrings
-     '1
-one
-	two three four 5 five' asArrayOfSubstrings
-    "
-!
+
 
 asCollectionOfLines
     "return a collection containing the lines (separated by cr)
@@ -1889,17 +1759,17 @@
 !
 
 asCollectionOfSubstringsSeparatedBy:aCharacter
-    "return a collection containing the lines (separated by aCharacter)
-     of the receiver. If aCharacter occurs multiple times in a row,
+    "re!
+
+asCollectionOfSubstringsSeparatedByAll:aSeparatorString
+    "return a collection containing the lines (separated by aSeparatorString)
+     of the receiver. If aSeparatorString occurs multiple times in a row,
      the result will contain empty strings."
 
-    ^ self asCollectionOfSubCollectionsSeparatedBy:aCharacter
-
-    "
-     '1 one:2 two:3 three:4 four:5 five' withCRs asCollectionOfSubstringsSeparatedBy:$:
-     '1 one 2 two 3 three 4 four 5 five' withCRs asCollectionOfSubstringsSeparatedBy:Character space
-    "
-!
+    ^ self asCollectionOfSubCollectionsSeparatedByAll:aSeparatorString
+
+    "
+     '1::2::3::4::5::' asCollectionOfSubstrin
 
 asCollectionOfSubstringsSeparatedByAll:aSeparatorString
     "return a collection containing the lines (separated by aSeparatorString)
@@ -1914,6 +1784,16 @@
 !
 
 asCollectionOfSubstringsSeparatedByAny:aCollectionOfSeparators
+    "return a ':'
+     'hello:world:isnt:this nice' asCollectionOfSubstringsSeparatedByAny:(Array with:$: with:Character space)
+     'hello:world:isnt:this nice' asCollectionOfSubstringsSeparatedByAny:': '
+     'h1e2l3l4o' asCollectionOfSubstringsSeparatedByAny:($1 to: $9)
+    "
+!
+
+asCollectionOfWords
+    "return a collection containing the words (separated by whitespace)
+     of the receiver. Multiple occurrencasCollectionOfSubstringsSeparatedByAny:aCollectionOfSeparators
     "return a collection containing the words (separated by any character
      from aCollectionOfSeparators) of the receiver.
      This allows breaking up strings using any character as separator."
@@ -1949,9 +1829,7 @@
      ' foo bar__baz__bla__ bar ' asCollectionOfWords     
      ' foo __bar__baz__bla__ bar ' asCollectionOfWords     
     "
-!
-
-asCollectionOfWordsDo:aBlock
+   isasCollectionOfWordsDo:aBlock
     "evaluate aBlock for each word (separated by whitespace) of the receiver.
      Multiple occurrences of whitespace characters will be treated like one
      - i.e. whitespace is skipped.
@@ -1988,24 +1866,7 @@
      '' asCollectionOfWordsDo:[:w | Transcript showCR:w]
      '      ' asCollectionOfWordsDo:[:w | Transcript showCR:w]
     "
-!
-
-asComposedText
-    "ST-80 compatibility
-     - ST/X does not (as today) support composedTexts."
-
-    ^ ComposedText fromString:self string
-
-    "Modified: 27.4.1996 / 13:30:30 / cg"
-!
-
-asFilename
-    "return a Filename with pathname taken from the receiver"
-
-    ^ Filename named:self "(self asSingleByteStringReplaceInvalidWith:$?)"
-
-    "Modified: 20.5.1996 / 09:38:15 / cg"
-!
+
 
 asFixedPoint
     "read a fixedPoint number from the receiver.
@@ -2019,13 +1880,25 @@
      '12345' asFixedPoint
      '(1/5)' asFixedPoint
      'foo' asFixedPoint
-     Object errorSignal handle:[:ex | ex return:0] do:['foo' asFixedPoint]
-    "
-
-    "Modified: / 25.10.1997 / 15:19:00 / cg"
+     Object errorSignal handle:[:ex | ex r  '3.14157' asFixedPoint:2
+     'foo' asFixedPoint:2
+    "
+
+    "Modified: / 25.10.1997 / 15:21:57 / cg"
 !
 
-asFixedPoint:scale
+asFloat
+    "read a float number from the receiver.
+     Notice, that errors may occur during the read,
+     so you better setup some exception handler when using this method."
+
+    ^ (Number readFromString:self) asFloat
+
+    "
+     '0.123' asFloat
+     '12345' asFloat
+     '(1/5)' asFloat
+     Object errorSignal handle:[:ex | ex returasFixedPoint:scale
     "read a fixedPoint number with scale number of post-decimal digits
      from the receiver. Scale controls the number of displayed digits,
      not the number of actually valid digits.
@@ -2043,9 +1916,9 @@
     "
 
     "Modified: / 25.10.1997 / 15:21:57 / cg"
-!
-
-asFloat
+
+
+aasFloat
     "read a float number from the receiver.
      Notice, that errors may occur during the read,
      so you better setup some exception handler when using this method."
@@ -2061,40 +1934,38 @@
 !
 
 asInteger
-    "read an integer from the receiver.
+    "convert the receiver into an integer.
      Notice, that errors may occur during the read,
-     so you better setup some exception handler when using this method."
+     so you better setup some exception handler when using this method.
+     Also notice, that this method here is more strict than the code found
+     in other smalltalks. 
+     For less strict integer reading, use Integer readFrom:aString"
 
     ^ Integer readFromString:self
 
     "
      '12345678901234567890' asInteger
      '-1234' asInteger
-     '0.123' asInteger   <- reader stops at ., returning 0 here
+
+     The following raises an error:
+         '0.123' asInteger   <- reader stops at ., returning 0 here
+
+     whereas the less strict readFrom does not:
+         Integer readFrom:'0.123'          <- reader stops at ., returning 0 here
+
+     '0.123' asInteger   
      '0.123' asNumber    <- returns what you expect
      Object errorSignal handle:[:ex | ex return:0] do:['foo' asInteger]
-    "
-!
-
-asLowercase
+
+    "
+:c
+ asLowercase
     "return a copy of myself in lowercase letters"
 
     |newStr c bitsPerCharacter
-     mySize "{ Class: SmallInteger }" |
-
-    mySize := self size.
-    mySize == 0 ifTrue:[^ self].
-    newStr := self species new:mySize.
-    bitsPerCharacter := newStr bitsPerCharacter.
-
-    1 to:mySize do:[:i |
-        c := (self at:i) asLowercase.
-        c bitsPerCharacter > bitsPerCharacter ifTrue:[
-            newStr := c stringSpecies fromString:newStr.
-        ].
-        newStr at:i put:c
-    ].
-    ^ newStr
+     mySize "{ Class: SmallInteger }   ].
+    newString at:1 put:firstCharAsLowercase.
+    ^ newString
 
     "
      'HelloWorld' asLowercase
@@ -2102,7 +1973,12 @@
     "
 !
 
-asLowercaseFirst
+asNumber
+    "read a number from the receiver.
+     Notice, that (in contrast to ST-80) errors may occur during the read,
+     so you better setup some signal handler when using this method.
+     Also notice, that this is meant to read end-user numbers from a string;
+     it does not handle smalltalk nuasLowercaseFirst
     "return a copy of myself where the first character is converted to lowercase."
 
     |newString firstChar firstCharAsLowercase|
@@ -2123,9 +1999,9 @@
      'HelloWorld' asLowercase
      'HelloWorld' asLowercaseFirst
     "
-!
-
-asNumber
+
+
+  asNumber
     "read a number from the receiver.
      Notice, that (in contrast to ST-80) errors may occur during the read,
      so you better setup some signal handler when using this method.
@@ -2146,9 +2022,7 @@
      'foo'     asNumber
      Object errorSignal handle:[:ex | ex returnWith:0] do:['foo' asNumber]
     "
-!
-
-asNumberFromFormatString:ignored
+   'DasNumberFromFormatString:ignored
     "read a number from the receiver, ignoring any nonDigit characters.
      This is typically used to convert from strings which include
      dollar-signs or millenium digits. However, this method also ignores
@@ -2167,21 +2041,7 @@
      '(5/6)'   asNumberFromFormatString:'foo'
      'foo'     asNumberFromFormatString:'foo'
     "
-!
-
-asOneByteString
-    "return the receiver converted to a 'normal' string.
-     Same as asSingleByteString - for compatibility."
-
-    ^ self asSingleByteString
-!
-
-asSingleByteString
-    "return the receiver converted to a 'normal' string.
-     Raises an error if unrepresentable characters are encountered."
-
-    ^ String fromString:self
-!
+
 
 asSingleByteStringIfPossible
     "if possible, return the receiver converted to a 'normal' string.
@@ -2189,15 +2049,22 @@
 
     self bitsPerCharacter == 8 ifTrue:[^ self].
     (self contains:[:char | char codePoint > 255]) ifFalse:[^ self asSingleByteString].
-    ^ self
-
-    "
-     'hello' asSingleByteStringIfPossible
-     'hello' asUnicodeString asSingleByteStringIfPossible
-    "
+    ^
+	] ifFalse:[
+	    newString at:idx put:replacementCharacter
+	].
+    ].
+    ^ newString
+
+    "Created: 30.6.1997 / 13:02:14 / cg"
 !
 
-asSingleByteStringReplaceInvalidWith:replacementCharacter
+asSoundexCode
+    "return a soundex string or nil.
+     Soundex returns similar codes for similar sounding words, making it a useful
+     tool when searching for words where the correct spelling is unknown.
+     (read Knuth or search the web if you dont know what a soundex code is).
+     Caveat: 'similar soundingasSingleByteStringReplaceInvalidWith:replacementCharacter
     "return the receiver converted to a 'normal' string,
      with invalid characters replaced by replacementCharacter.
      Can be used to convert from 16-bit strings to 8-bit strings
@@ -2219,9 +2086,7 @@
     ^ newString
 
     "Created: 30.6.1997 / 13:02:14 / cg"
-!
-
-asSoundexCode
+lltalasSoundexCode
     "return a soundex string or nil.
      Soundex returns similar codes for similar sounding words, making it a useful
      tool when searching for words where the correct spelling is unknown.
@@ -2295,21 +2160,7 @@
      'bob' asSoundexCode
      'bop' asSoundexCode
     "
-!
-
-asString
-    "return myself - I am a string"
-
-    ^ self
-!
-
-asStringCollection
-    "return a collection of lines from myself."
-
-    ^ StringCollection fromString:self "string"
-
-    "Modified: 13.5.1996 / 20:36:59 / cg"
-!
+
 
 asSymbol
     "return a unique symbol with the name taken from my characters.
@@ -2318,12 +2169,20 @@
 
     |str|
 
-    str := self string.
-    str ~~ self ifTrue:[ ^ str asSymbol ].
-    ^ self asSingleByteString asSymbol
+    str := self stf ifTrue:[
+       ^ s asSymbolIfInterned
+    ].
+    ^ nil.
+
+    "Created: 22.5.1996 / 16:37:04 / cg"
 !
 
-asSymbolIfInterned
+asText
+    "return a Text-object (collection of lines) from myself."
+
+    "this test allows for small non-gui apps to be built without libbasic2 (where Text is)"
+    Text isNil ifTrue:[^ self].
+  asSymbolIfInterned
     "if a symbol with the receivers characters is already known, return it.
      Otherwise, return nil. This can be used to query for an existing
      symbol and is the same as
@@ -2342,19 +2201,19 @@
     ^ nil.
 
     "Created: 22.5.1996 / 16:37:04 / cg"
-!
-
-asText
-    "return a Text-object (collection of lines) from myself."
-
-    "this test allows for small non-gui apps to be built without libbasic2 (where Text is)"
-    Text isNil ifTrue:[^ self].
-    ^ Text fromString:self
-
-    "Created: 12.5.1996 / 10:41:14 / cg"
-!
-
-asTitlecase
+ at:i) asLowercase.
+	].
+	c bitsPerCharacter > bitsPerCharacter ifTrue:[
+	    newStr := c stringSpecies fromString:newStr.
+	].
+	newStr at:i put:c
+    ].
+    ^ newStr
+
+    "
+     'helloWorld' asTitlecase
+     'HelloWorld' asTitlecase
+     'HELLOWORLD' asTitlecaseasTitlecase
     "return a version of the receiver, where the first character is converted to titlecase,
      and everything else to lowercase.
      See the comment in Character on what titlecase is."
@@ -2385,9 +2244,7 @@
      'HELLOWORLD' asTitlecase
      'helloworld' asTitlecase
     "
-!
-
-asTitlecaseFirst
+stChaasTitlecaseFirst
     "return a version of the receiver, where the first character is converted to titlecase.
      Titlecase is much like uppercase for most characters, with the exception of some combined
      (2-character glyphs), which consist of an upper- and lower-case characters.
@@ -2425,20 +2282,7 @@
      'helloWorld' asTitlecaseFirst
      'HelloWorld' asTitlecaseFirst
     "
-!
-
-asTwoByteString
-    "return the receiver converted to a two-byte string.
-     Will be obsolete soon."
-
-    ^ TwoByteString fromString:self
-!
-
-asURI
-    "return an URI with string taken from the receiver"
-
-    ^ URI fromString:self
-!
+
 
 asURL
     "return an URL-object from myself."
@@ -2448,16 +2292,7 @@
     "
      'http://www.exept.de:80/index.html' asURL host
      'http://www.exept.de:80/index.html' asURL port
-     'http://www.exept.de:80/index.html' asURL method
-     'http://www.exept.de:80/index.html' asURL path
-    "
-!
-
-asUnicode16String
-    "thats not really true - characters above ascii 16r7F may need special treatment"
-
-    ^ ((Unicode16String new:self size) replaceFrom:1 to:self size with:self startingAt:1)
-!
+     'http://www.exept.de:80/index.html' asURL 
 
 asUnicode32String
     "thats not really true - characters above ascii 16r7F may need special treatment"
@@ -2474,6 +2309,23 @@
 asUppercase
     "return a copy of myself in uppercase letters"
 
+    |newStr c bitsPerChara:c
+    ].
+    ^ newStr
+
+    "
+     'helloWorld' asUppercase
+     'helloWorld' asUppercaseFirst
+     (Character value:16rB5) asString asUppercase   -- needs 16 bits !!
+    "
+!
+
+asUppercaseFirst
+    "return a version of the receiver, where the first character is converted to uppercase.
+     If the first character is already uppercase, or there is no uppercase for it, return the
+   asUppercase
+    "return a copy of myself in uppercase letters"
+
     |newStr c bitsPerCharacter
      mySize "{ Class: SmallInteger }" |
 
@@ -2494,11 +2346,7 @@
     "
      'helloWorld' asUppercase
      'helloWorld' asUppercaseFirst
-     (Character value:16rB5) asString asUppercase   -- needs 16 bits !!
-    "
-!
-
-asUppercaseFirst
+     (Character value:16rB5) asString asUppercase   -- needs 16 bits irstCharAsUppeasUppercaseFirst
     "return a version of the receiver, where the first character is converted to uppercase.
      If the first character is already uppercase, or there is no uppercase for it, return the
      receiver."
@@ -2522,32 +2370,28 @@
      'helloWorld' asUppercaseFirst
      'HelloWorld' asUppercaseFirst
     "
-!
-
-string
-    "return the receiver - for ST-80 compatibility"
-
-    ^ self
-
-    "Modified: 27.4.1996 / 13:29:30 / cg"
+#bold)
+    "
+
+    "Modified: 28.6.1997 / 00:13:17 / cg"
 !
 
-tokensBasedOn:aCharacter
-    "this is an ST-80 alias for the ST/X method
-	asCollectionOfSubstringsSeparatedBy:"
-
-    ^ self asCollectionOfSubstringsSeparatedBy:aCharacter
-
-    "
-     'hello:world:isnt:this nice' tokensBasedOn:$:
-     'foo,bar,baz' tokensBasedOn:$,
-     '/etc/passwd' asFilename readStream nextLine tokensBasedOn:$:
-    "
-! !
-
-!CharacterArray methodsFor:'copying'!
-
-, aStringOrCharacter
+,, aString
+    "concatenate with a newLine in between"
+
+    ^ (self copyWith:Character cr) , aString
+
+   "
+     hello ,, world
+     'hello' ,, 'world'
+   "
+!
+
+concatenate:string1 and:string2
+    "return the concatenation of myself and the arguments, string1 and string2.
+     This is equivalent to self , string1 , string2
+     - generated by compiler when such a construct is detected and the receiver
+     is known to be a strin, aStringOrCharacter
     "redefined to allow characters and mixed strings to be appended.
      This is nonStandard, but convenient"
 
@@ -2581,9 +2425,9 @@
     "
 
     "Modified: 28.6.1997 / 00:13:17 / cg"
-!
-
-,, aString
+
+
+,,, aString
     "concatenate with a newLine in between"
 
     ^ (self copyWith:Character cr) , aString
@@ -2826,11 +2670,9 @@
     ^ encoder decodeString:self.
 !
 
-encodeFrom:oldEncoding into:newEncoding
-    ^ CharacterEncoder encodeString:self from:oldEncoding into:newEncoding
-!
-
-rot13
+poilers.
+      A major advantage of rot13 over rot(N) for other N is that it
+      is self-inverse, so the same code crot13
      "Usenet: from `rotate alphabet 13 places']
       The simple Caesar-cypher encryption that replaces each English
       letter with the one 13 places forward or back along the alphabet,
@@ -2894,9 +2736,7 @@
 	]
       ]
     "
-!
-
-utf8DecodedWithTwoByteCharactersReplacedBy:replacementCharacter
+ nextutf8DecodedWithTwoByteCharactersReplacedBy:replacementCharacter
     "Interpreting myself as an UTF-8 representation, decode and return
      the decoded string. Suppress all 2-byte (above 16rFF) characters,
      and replace them with replacementCharacter"
@@ -2918,47 +2758,32 @@
      (Character value:16r220) utf8Encoded
 	utf8DecodedWithTwoByteCharactersReplacedBy:(Character space)
     "
-!
-
-utf8Encoded
-    "Return my UTF-8 representation as a new String"
-
-    |s|
-
-    s := WriteStream on:(String uninitializedNew:self size).
-    self utf8EncodedOn:s.
-    ^ s contents
-!
-
-utf8EncodedOn:aStream
-    "append my UTF-8 representation to the argument, aStream."
-
-
-    self do:[:c|
-	c utf8EncodedOn:aStream.
-    ].
-! !
-
-!CharacterArray methodsFor:'padded copying'!
-
-centerPaddedTo:newSize
-     "return a new string consisting of the receivers characters,
-     plus spaces up to length and center the receivers characters in
-     the resulting string.
+
+
+centerPaddedTo:size with:padCharacter
+    "return a new string of length size, which contains the receiver
+     centered (i.e. padded on both sides).
+     Characters are filled with padCharacter.
      If the receivers size is equal or greater than the length argument,
      the original receiver is returned unchanged."
 
-     ^ self centerPaddedTo:newSize with:(Character space)
-
-    "
-     'foo' centerPaddedTo:10
-     123 printString centerPaddedTo:10
-    "
-
-    "Created: 25.11.1995 / 10:53:57 / cg"
+    |len s|
+
+    len := self size.
+    (len < 
+    "
+     'foo' centerPaddedTo:11 with:$.
+     'fooBar' centerPaddedTo:5 with:$.
+     123 printString centerPaddedTo:10 with:$.
+     (' ' , 123 printString) centerPaddedTo:10 with:$.
+     (Float pi printString) centerPaddedTo:15 with:(Character space)
+     (Float pi printString) centerPaddedTo:15 with:$-
+     (' ' , Float pi class name) centerPaddedTo:15 with:$.
+    "
 !
 
-centerPaddedTo:size with:padCharacter
+decimalPaddedTo:size and:afterPeriod at:decimalCharacter
+    "return a new string of overall length size, whicenterPaddedTo:size with:padCharacter
     "return a new string of length size, which contains the receiver
      centered (i.e. padded on both sides).
      Characters are filled with padCharacter.
@@ -2983,9 +2808,7 @@
      (Float pi printString) centerPaddedTo:15 with:$-
      (' ' , Float pi class name) centerPaddedTo:15 with:$.
     "
-!
-
-decimalPaddedTo:size and:afterPeriod at:decimalCharacter
+123.1decimalPaddedTo:size and:afterPeriod at:decimalCharacter
     "return a new string of overall length size, which contains the receiver
      aligned at the decimal-period column and afterPeriod characters to the right
      of the period. The periodCharacter is passed as arguments (allowing for US and European formats
@@ -3011,9 +2834,7 @@
     "
 
     "Created: 23.12.1995 / 13:11:52 / cg"
-!
-
-decimalPaddedTo:size and:afterPeriod at:decimalCharacter withLeft:leftPadChar right:rightPadChar
+: 23.decimalPaddedTo:size and:afterPeriod at:decimalCharacter withLeft:leftPadChar right:rightPadChar
     "return a new string of overall length size, which contains the receiver
      aligned at the decimal-period column and afterPeriod characters to the right
      of the period.
@@ -3061,23 +2882,7 @@
     "
 
     "Modified: 23.12.1995 / 13:08:18 / cg"
-!
-
-leftPaddedTo:size
-    "return a new string of length size, which contains the receiver
-     right-adjusted (i.e. padded on the left).
-     Characters on the left are filled with spaces.
-     If the receivers size is equal or greater than the length argument,
-     the original receiver is returned unchanged."
-
-    ^ self leftPaddedTo:size with:(Character space)
-
-    "
-     'foo' leftPaddedTo:10
-     'fooBar' leftPaddedTo:5
-     123 printString leftPaddedTo:10
-    "
-!
+
 
 paddedTo:newSize
      "return a new string consisting of the receivers characters,
@@ -3096,6 +2901,19 @@
 !CharacterArray methodsFor:'pattern matching'!
 
 compoundMatch:aString
+    "like match, but thfied: / 16.12.1999 / 01:22:08 / cg"
+!
+
+compoundMatch:aString ignoreCase:ignoreCase
+    "like match, but the receiver may be a compound match pattern,
+     consisting of multiple simple patterns, separated by semicolons.
+     This is usable with fileName pattern fields."
+
+    |matchers|
+
+    matchers := self asCollectionOfSubstringsSeparatedBy:$;.
+    matchers do:[:aPattern |
+	(aPattern match:aString igcompoundMatch:aString
     "like match, but the receiver may be a compound match pattern,
      consisting of multiple simple patterns, separated by semicolons.
      This is usable with fileName pattern fields."
@@ -3113,9 +2931,7 @@
 
     "Modified: / 30.1.1998 / 11:40:18 / stefan"
     "Modified: / 16.12.1999 / 01:22:08 / cg"
-!
-
-compoundMatch:aString ignoreCase:ignoreCase
+h:'focompoundMatch:aString ignoreCase:ignoreCase
     "like match, but the receiver may be a compound match pattern,
      consisting of multiple simple patterns, separated by semicolons.
      This is usable with fileName pattern fields."
@@ -3141,25 +2957,24 @@
     "Modified: / 15.4.1997 / 15:50:33 / cg"
     "Modified: / 30.1.1998 / 11:40:18 / stefan"
     "Created: / 16.12.1999 / 01:21:35 / cg"
-!
-
-findMatchString:matchString
-    "like findString/indexOfSubCollection, but allowing match patterns.
-     find matchstring; if found, return the index;
-     if not found, return 0."
-
-    ^ self findMatchString:matchString startingAt:1 ignoreCase:false ifAbsent:0
-!
+
 
 findMatchString:matchString startingAt:index
     "like findString, but allowing match patterns.
      find matchstring, starting at index. if found, return the index;
      if not found, return 0."
 
-    ^ self findMatchString:matchString startingAt:index ignoreCase:false ifAbsent:0
+    ^ self findMatchString:matchString startingAt:index ignoreCaseartingAt:3 ignoreCase:true ifAbsent:0
+    "
+
+    "Modified: 13.9.1997 / 06:31:22 / cg"
 !
 
-findMatchString:matchString startingAt:index ignoreCase:ignoreCase ifAbsent:exceptionBlock
+includesMatchString:matchString
+    "like includesString, but allowing match patterns.
+     find matchstring; if found, return true, otherwise return false"
+
+    ^ (self findMatchString:findMatchString:matchString startingAt:index ignoreCase:ignoreCase ifAbsent:exceptionBlock
     "like findString, but allowing match patterns.
      find matchstring, starting at index. if found, return the index;
      if not found, return the result of evaluating exceptionBlock.
@@ -3220,23 +3035,15 @@
     "
 
     "Modified: 13.9.1997 / 06:31:22 / cg"
-!
-
-includesMatchString:matchString
-    "like includesString, but allowing match patterns.
-     find matchstring; if found, return true, otherwise return false"
-
-    ^ (self findMatchString:matchString) ~~ 0
-
-    "
-     'hello world' includesMatchString:'h*'
-     'hello world' includesMatchString:'h[aeiou]llo'
-     'hello world' includesMatchString:'wor*'
-     'hello world' includesMatchString:'woR*'
-    "
-!
-
-includesMatchString:matchString caseSensitive:caseSensitive
+llo world' includesMatchString:'h*' caseSensitive:false  
+
+     'hello world' includesMatchString:'h[aeiou]llo' caseSensitive:true   
+     'hello world' includesMatchString:'h[aeiou]llo' caseSensitive:false  
+
+     'hello world' includesMatchString:'wor*' caseSensitive:true
+     'hello world' includesMatchString:'wor*' caseSensitive:false
+
+     'hello world' includesMatchString:'woR*' caseSensitive:true  includesMatchString:matchString caseSensitive:caseSensitive
     "like includesString, but allowing match patterns.
      find matchstring; if found, return true, otherwise return false"
 
@@ -3257,9 +3064,7 @@
      'hello world' includesMatchString:'woR*' caseSensitive:true   
      'hello world' includesMatchString:'woR*' caseSensitive:false  
     "
-!
-
-match:aString
+:'*f'match:aString
     "return true if aString matches self, where self may contain meta-match
      characters $* (to match any string) or $# (to match any character).
      or [...] to match a set of characters.
@@ -3286,9 +3091,7 @@
     "
 
     "Modified: / 9.6.1998 / 18:50:00 / cg"
-!
-
-match:aString from:start to:stop ignoreCase:ignoreCase
+     match:aString from:start to:stop ignoreCase:ignoreCase
     "return true if part of aString matches myself,
      where self may contain meta-match
      characters $* (to match any string) or $# (to match any character)
@@ -3330,9 +3133,7 @@
     "
 
     "Modified: / 10.11.1998 / 21:43:46 / cg"
-!
-
-match:aString ignoreCase:ignoreCase
+ compmatch:aString ignoreCase:ignoreCase
     "return true if aString matches self, where self may contain meta-match
      characters $* (to match any string) or $# (to match any character)
      or [...] to match a set of characters.
@@ -3367,22 +3168,7 @@
     "
 
     "Modified: 2.4.1997 / 17:28:58 / cg"
-!
-
-matches:aPatternString
-    "return true if the receiver matches aString, where aPatternString may contain meta-match
-     characters $* (to match any string) or $# (to match any character).
-     or [...] to match a set of characters.
-     Lower/uppercase are considered different.
-     NOTICE: match-meta character interpretation is like in unix-matching,
-	     NOT the ST-80 meaning."
-
-    ^ aPatternString match:self
-
-
-! !
-
-!CharacterArray methodsFor:'printing & storing'!
+
 
 article
     "return an article string for the receiver."
@@ -3410,22 +3196,22 @@
 
     n := self occurrencesOf:$'.
     n == 0 ifFalse:[
+	s := String new:(n 
+
+basicStoreString
+    "return a String for storing myself"
+
+    |s n index|
+
+    n := self occurrencesOf:$'.
+    n == 0 ifFalse:[
 	s := String new:(n + 2 + self size).
 	s at:1 put:$'.
 	index := 2.
 	self do:[:thisChar |
 	    (thisChar == $') ifTrue:[
 		s at:index put:thisChar.
-		index := index + 1.
-	    ].
-	    s at:index put:thisChar.
-	    index := index + 1.
-	].
-	s at:index put:$'.
-	^ s
-    ].
-    ^ '''' , self , ''''
-!
+		index := inde
 
 displayString
     "return a string to display the receiver - use storeString to have quotes around."
@@ -3449,15 +3235,18 @@
     "put the raw storeString of myself on aStream"
 
     self do:[:thisChar |
+	(
+
+printWithQuotesDoubledOn:aStream
+    "put the raw storeString of myself on aStream"
+
+    self do:[:thisChar |
 	(thisChar == $') ifTrue:[aStream nextPut:thisChar].
 	aStream nextPut:thisChar
     ]
 
     "Modified: / 15.6.1998 / 17:21:17 / cg"
     "Created: / 15.6.1998 / 17:22:13 / cg"
-! !
-
-!CharacterArray methodsFor:'public'!
 
 isUnarySelector
     "Answer true if the receiver contains only chars in an ANSI unary method selector, false otherwise."
@@ -3468,7 +3257,7 @@
     "Modified: / 20-04-2005 / 12:20:43 / cg"
 ! !
 
-!CharacterArray methodsFor:'queries'!
+!CharacterArray methodsFor:'quer
 
 bitsPerCharacter
     "return the underlying strings bitsPerCharacter
@@ -3482,15 +3271,7 @@
 
     max := 8.
     self do:[:eachCharacter |
-	max := max max:(eachCharacter bitsPerCharacter)
-    ].
-    ^ max
-
-    "
-     'hello' bitsPerCharacter
-     'hello' asText allBold bitsPerCharacter
-    "
-!
+	max := max max:(eachCharacter bitsPerCharact
 
 contains8BitCharacters
     "return true, if the underlying string contains 8BitCharacters (or widers)
@@ -3506,8 +3287,7 @@
     "
      'hello' contains8BitCharacters
      'hello' asText allBold contains8BitCharacters
-    "
-!
+    "
 
 encoding
     "return the strings encoding, as a symbol.
@@ -3526,16 +3306,7 @@
 !
 
 hasIcon
-    "for LabelAndIcon compatibility"
-
-    ^ false
-!
-
-hasImage
-    "for LabelAndIcon compatibility"
-
-    ^ false
-!
+    "for LabelAndIcon compatibility"
 
 heightOn:aGC
     "return the size of the recevier in device units if displayed on aGC"
@@ -3558,6 +3329,23 @@
 !
 
 isValidSmalltalkIdentifier
+  foo_bar_' isValidSmalltalkIdentifier
+     'foo ' isValidSmalltalkIdentifier
+     ' foo' isValidSmalltalkIdentifier
+    "
+!
+
+knownAsSymbol
+    "for now, only single character strings are allowed as symbols.
+     This method is redefined in String."
+
+    ^ false
+!
+
+leftIndent
+    "if the receiver starts with spaces, return the number of spaces
+     at the left - otherwise, return 0.
+     If the receiver consistisValidSmalltalkIdentifier
     "return true, if the receivers characters make up a valid smalltalk identifier"
 
     |scanner tok|
@@ -3579,39 +3367,21 @@
      'foo ' isValidSmalltalkIdentifier
      ' foo' isValidSmalltalkIdentifier
     "
+
+     '         ' leftIndent
+    "
+
+    "Modified: 20.4.1996 / 19:28:43 / cg"
 !
 
-knownAsSymbol
-    "for now, only single character strings are allowed as symbols.
-     This method is redefined in String."
-
-    ^ false
-!
-
-leftIndent
+stringSpecies
+    "return the underlying strings bitsPerChaleftIndent
     "if the receiver starts with spaces, return the number of spaces
      at the left - otherwise, return 0.
      If the receiver consists of spaces only, return the receivers size."
 
     |index "{Class: SmallInteger }"
-     end   "{Class: SmallInteger }"|
-
-    index := 1.
-    end := self size.
-    [index <= end] whileTrue:[
-	(self at:index) isSeparator ifFalse:[^ index - 1].
-	index := index + 1
-    ].
-    ^ end
-
-    "
-     '    hello' leftIndent
-     'foo      ' leftIndent
-     '         ' leftIndent
-    "
-
-    "Modified: 20.4.1996 / 19:28:43 / cg"
-!
+     end   "{Class: SmallInteger }
 
 stringSpecies
     "return the underlying strings bitsPerCharacter
@@ -3624,9 +3394,7 @@
 
     "
      'hello' stringSpecies
-     'hello' asText allBold stringSpecies
-    "
-!
+     'hello' asText allBold stringSp
 
 widthFrom:startIndex to:endIndex on:aGC
     "return ths size of part of the recevier in device units if displayed on aGC"
@@ -3637,7 +3405,7 @@
      'hello world' widthFrom:1 to:5 on:(View new)
      'hello' widthOn:(View new)
     "
-!
+
 
 widthOn:aGC
     "return ths size of the recevier in device units if displayed on aGC"
@@ -3652,7 +3420,7 @@
     "Modified: 17.4.1997 / 12:50:23 / cg"
 ! !
 
-!CharacterArray methodsFor:'regular expressions'!
+!Charac
 
 allRegexMatches: rxString
     "return a collection of substrings in the receiver, which match the regular expression in rxString"
@@ -3667,15 +3435,14 @@
 !
 
 asRegex
+    "Compile t
+
+asRegex
     "Compile the receiver as a regex matcher.
      May raise RxParser>>syntaxErrorSignal or RxParser>>compilationErrorSignal.
      This is a part of the Regular Expression Matcher package,
 	(c) 1996, 1999 Vassili Bykov.
-     Refer to `documentation' protocol of RxParser class for details."
-
-    ^ Regex::RxParser preferredMatcherClass
-	for: (Regex::RxParser new parse: self)
-!
+     Refer to `documentation' protocol of RxParser class f
 
 asRegexIgnoringCase
     "Compile the receiver as a regex matcher.
@@ -3685,9 +3452,7 @@
      Refer to `documentation' protocol of RxParser class for details."
 
     ^ Regex::RxParser preferredMatcherClass
-	    for: (Regex::RxParser new parse: self)
-	    ignoreCase: true
-!
+	    for: (Regex::RxP
 
 copyWithRegex: rxString matchesReplacedWith: aString
     ^ rxString asRegex copy: self replacingMatchesWith: aString
@@ -3700,16 +3465,14 @@
 matchesRegex: regexString
     "Test if the receiver matches a regex.
      May raise RxParser>>regexErrorSignal or child signals.
+     This is a part of the Regular Expr
+
+matchesRegex: regexString
+    "Test if the receiver matches a regex.
+     May raise RxParser>>regexErrorSignal or child signals.
      This is a part of the Regular Expression Matcher package,
 	(c) 1996, 1999 Vassili Bykov.
-     Refer to `documentation' protocol of RxParser class for details."
-
-    ^regexString asRegex matches: self
-
-    "
-     'hello world' matchesRegex:'h.*d'.
-    "
-!
+     Refer to `d
 
 matchesRegexIgnoringCase: regexString
     "Test if the receiver matches a regex.
@@ -3721,9 +3484,7 @@
     ^regexString asRegexIgnoringCase matches: self
 
     "
-     'hElLo wOrld' matchesRegexIgnoringCase:'h.*d'.
-    "
-!
+     'hElLo w
 
 prefixMatchesRegex: regexString
     "Test if the receiver's prefix matches a regex.
@@ -3736,14 +3497,16 @@
 !
 
 prefixMatchesRegexIgnoringCase: regexString
+    "
+
+prefixMatchesRegexIgnoringCase: regexString
     "Test if the receiver's prefix matches a regex.
      May raise RxParser class>>regexErrorSignal or child signals.
      This is a part of the Regular Expression Matcher package,
 	(c) 1996, 1999 Vassili Bykov.
      Refer to `documentation' protocol of RxParser class for details."
 
-    ^regexString asRegexIgnoringCase matchesPrefix: self
-!
+    ^regexString asRegexIgn
 
 regex: rxString matchesCollect: aBlock
     "for all substrings in the receiver which match the regular expression in rxString, evaluate aBlock,
@@ -3753,9 +3516,7 @@
 
     "
      'hello world' regex:'\w+' matchesCollect:[:each | each asUppercase ].
-     '1234 hello 456 world' regex:'\d+' matchesCollect:[:each | Number readFrom:each ].
-    "
-!
+     '1234 hello 456 world' regex:'\d+' matchesCollect:[:
 
 regex:rxString matchesDo: aBlock
     "for all substrings in the receiver which match the regular expression in rxString, evaluate aBlock"
@@ -3770,6 +3531,17 @@
 !CharacterArray methodsFor:'special string converting'!
 
 chopTo:maxLen
+    "if the receivers size is less or equal to ma15
+     '1234567890123456' chopTo:15
+     'aShortString' chopTo:15
+     'aVeryLongNameForAStringThatShouldBeShortened' chopTo:15
+    "
+!
+
+contractAtBeginningTo:maxLen
+    "if the receivers size is less or equal to maxLen, return it.
+     Otherwise, return a copy of the receiver, where some characters
+     at the beginning have been chopTo:maxLen
     "if the receivers size is less or equal to maxLen, return it.
      Otherwise, return a copy of the receiver, where some characters
      in the middle have been removed for a total string length
@@ -3792,9 +3564,7 @@
      'aShortString' chopTo:15
      'aVeryLongNameForAStringThatShouldBeShortened' chopTo:15
     "
-!
-
-contractAtBeginningTo:maxLen
+ctAtBcontractAtBeginningTo:maxLen
     "if the receivers size is less or equal to maxLen, return it.
      Otherwise, return a copy of the receiver, where some characters
      at the beginning have been replaced by '...' for a total string length
@@ -3813,9 +3583,8 @@
      'aShortString' contractAtBeginningTo:15
      'aVeryLongNameForAStringThatShouldBeShortened' contractAtBeginningTo:15
     "
-!
-
-contractAtEndTo:maxLen
+5
+  contractAtEndTo:maxLen
     "if the receivers size is less or equal to maxLen, return it.
      Otherwise, return a copy of the receiver, where some characters
      at the end have been replaced by '...' for a total string length
@@ -3835,34 +3604,28 @@
      'aShortString' contractAtEndTo:15
      'aVeryLongNameForAStringThatShouldBeShortened' contractAtEndTo:15
     "
-!
-
-contractTo:maxLen
+
+			 contractTo:maxLen
     "if the receivers size is less or equal to maxLen, return it.
      Otherwise, return a copy of the receiver, where some characters
      in the middle have been replaced by '...' for a total string length
      of maxLen. Can be used to abbreviate long entries in tables."
 
     |sz "{ SmallInteger }"
-     halfSize "{ SmallInteger }"|
-
-    (sz := self size) > maxLen ifTrue:[
-	halfSize := maxLen // 2.
-	^ self copyReplaceFrom:halfSize - 1
-			    to:sz - maxLen + halfSize + 1
-			    with:'...'
-    ]
-
-    "
-     '12345678901234' contractTo:15
-     '123456789012345' contractTo:15
-     '1234567890123456' contractTo:15
-     'aShortString' contractTo:15
-     'aVeryLongNameForAStringThatShouldBeShortened' contractTo:15
-    "
-!
-
-expandPlaceholdersWith:argArrayOrDictionary
+     halfSize "{ SmallInteger }  '%%(1)0 gives %(1)0' expandPlaceholdersWith:#(123)
+     '%%10 gives %10' expandPlaceholdersWith:#(123)
+     '%%(10) gives %(10)' expandPlaceholdersWith:#(123)
+     '%test gives %1' expandPlaceholdersWith:#(123)
+    "
+
+    "
+     |dict|
+
+     dict := Dictionary new.
+     dict at:1 put:'one'.
+     dict at:$a put:'AAAAA'.
+     dict at:$b put:[ Time now ].
+     'hello %1 %a %b' expanexpandPlaceholdersWith:argArrayOrDictionary
     "return a copy of the receiver, where all %i escapes are
      replaced by corresponding arguments' printStrings from the argArrayOrDictionary.
      I.e. 'hello %1; how is %2' expandPlaceholdersWith:#('world' 'this') results
@@ -3959,22 +3722,17 @@
     "
 
     "Modified: 1.7.1997 / 00:53:24 / cg"
+ello\nworld\na\n\tnice\n\t\tstring' withEscapes
+     'hello\tworld\n' withEscapes
+     'hello\010world' withEscapes
+     'hello\r\nworld' withEscapes
+    "
+
+    "Modified: 12.5.1996 / 12:53:34 / cg"
 !
 
-withCRs
-    "return a new string consisting of receivers characters
-     with all \-characters replaced by cr-characters."
-
-    ^ self copyReplaceAll:$\ with:(Character cr)
-
-    "
-     'hello\world' withCRs
-    "
-
-    "Modified: / 18.7.1998 / 22:53:02 / cg"
-!
-
-withEscapes
+withMatchEscapes
+    "return a copy of the receiver withwithEscapes
     "return a new string consisting of receivers characters
      with all \X-character escapes replaced by corresponding-characters.
      (similar to the way C-language Strings are converted).
@@ -4111,9 +3869,7 @@
     "
 
     "Modified: 12.5.1996 / 12:53:34 / cg"
-!
-
-withMatchEscapes
+contewithMatchEscapes
     "return a copy of the receiver with all match characters escaped
      by $\ characters (to be usable as a match string).
      Return the receiver, if there are none."
@@ -4145,9 +3901,7 @@
     "
 
     "Modified: 2.4.1997 / 18:13:04 / cg"
-!
-
-withTabs
+67890withTabs
     "return a string consisting of the receivers characters
      where leading spaces are replaced by tabulator characters (assuming 8-col tabs).
      Notice: if the receiver does not contain any tabs, it is returned unchanged;
@@ -4178,9 +3932,7 @@
      '                7890' withTabs
      '                 890' withTabs
     "
-!
-
-withTabsExpanded
+    wwithTabsExpanded
     "return a string consisting of the receivers characters,
      where all tabulator characters are expanded into spaces (assuming 8-col tabs).
      Notice: if the receiver does not contain any tabs, it is returned unchanged;
@@ -4214,9 +3966,7 @@
     "
 
     "Modified: 12.5.1996 / 13:05:10 / cg"
-!
-
-withTabsExpanded:numSpaces
+9' , withTabsExpanded:numSpaces
     "return a string consisting of the receivers characters,
      where all tabulator characters are expanded into spaces (assuming numSpaces-col tabs).
      Notice: if the receiver does not contain any tabs, it is returned unchanged;
@@ -4309,23 +4059,16 @@
     "
 
     "Modified: 12.5.1996 / 13:05:10 / cg"
+  '    foo'     withoutLeadingSeparators
+     '       '     withoutLeadingSeparators
+     'foo'         withoutLeadingSeparators
+     ('  ' , Character tab asString , ' foo   ') withoutLeadingSeparators inspect
+    "
 !
 
-withoutCRs
-    "return a new collection consisting of receivers elements
-     with all cr-characters replaced by \-characters.
-     This is the reverse operation of withCRs."
-
-    ^ self copyReplaceAll:(Character cr) with:$\
-    "
-     'hello
-world' withoutCRs
-    "
-
-    "Modified: / 18.7.1998 / 22:53:08 / cg"
-!
-
-withoutLeadingSeparators
+withoutMatchEscapes
+    "return a copy of the receiver with all $\ removed or
+     the receivwithoutLeadingSeparators
     "return a copy of myself without leading separators.
      Notice: this does remove tabs, newline or any other whitespace.
      Returns an empty string, if the receiver consist only of whitespace."
@@ -4349,9 +4092,7 @@
      'foo'         withoutLeadingSeparators
      ('  ' , Character tab asString , ' foo   ') withoutLeadingSeparators inspect
     "
-!
-
-withoutMatchEscapes
+     withoutMatchEscapes
     "return a copy of the receiver with all $\ removed or
      the receiver, if there are none."
 
@@ -4384,24 +4125,18 @@
     "
 
     "Modified: 30.6.1997 / 13:40:23 / cg"
-!
-
-withoutPrefix:aString
-    "if the receiver startsWith aPrefix, return a copy without it.
-     Otherwise return the receiver"
-
-    (self startsWith:aString) ifTrue:[
-	^ self copyFrom:aString size + 1
-    ].
-    ^ self
-
-    "
-     'helloworld' withoutPrefix:'hello'
-     'helloworld' withoutPrefix:'foo'
+ators inspect
     "
 !
 
-withoutSeparators
+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."
+
+    |startIndex "{ Class: SmallInteger }"
+     enwithoutSeparators
     "return a copy of myself without leading and trailing whitespace.
      (but whiteSpace in-between is preserved)
      Whitespace is space, tab, newline, formfeed.
@@ -4436,9 +4171,7 @@
      '       ' withoutSeparators
      ('  foo' , Character tab asString , '    ') withoutSeparators inspect
     "
-!
-
-withoutSpaces
+ab aswithoutSpaces
     "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.
@@ -4474,9 +4207,7 @@
      'a     b'     withoutSpaces
      ('  foo' , Character tab asString , '    ') withoutSpaces inspect
     "
-!
-
-withoutTrailingSeparators
+atorswithoutTrailingSeparators
     "return a copy of myself without trailing separators.
      Notice: this does remove tabs, newline or any other whitespace.
      Returns an empty string, if the receiver consist only of whitespace."
@@ -4501,21 +4232,7 @@
      ('  ' , Character tab asString , ' foo   ') withoutTrailingSeparators inspect
      ('   foo' , Character tab asString) withoutTrailingSeparators inspect
     "
-! !
-
-!CharacterArray methodsFor:'substring searching'!
-
-findString:subString
-    "find a substring. if found, return the index;
-     if not found, return 0."
-
-    ^ self indexOfSubCollection:subString startingAt:1 ifAbsent:0 caseSensitive:true
-
-    "
-     'hello world' findString:'llo'
-     'hello world' findString:'ole'
-    "
-!
+
 
 findString:subString ifAbsent:exceptionBlock
     "find a substring. If found, return the index;
@@ -4525,17 +4242,16 @@
 !
 
 findString:subString startingAt:index
+    "find a substring,
+
+findString:subString startingAt:index
     "find a substring, starting at index. if found, return the index;
      if not found, return 0."
 
     ^ self indexOfSubCollection:subString startingAt:index ifAbsent:0 caseSensitive:true
 
     "
-     'hello yello' findString:'llo' startingAt:1
-     'hello yello' findString:'llo' startingAt:5
-     'hello yello' findString:'llo' startingAt:15
-    "
-!
+     'hello yello' fin
 
 findString:subString startingAt:index ifAbsent:exceptionBlock
     "find a substring, starting at index. if found, return the index;
@@ -4545,6 +4261,9 @@
 !
 
 includesString:aString
+    "return true, if a substring is contained in the 
+
+includesString:aString
     "return true, if a substring is contained in the receiver"
 
     ^ (self indexOfSubCollection:aString startingAt:1 ifAbsent:0 caseSensitive:true) ~~ 0
@@ -4552,12 +4271,16 @@
     "
      'hello world' includesString:'hel'
      'hello world' includesString:'rld'
-     'hello world' includesString:'llo'
-     'hello world' includesString:'LLO'
+     'hello world' includesStrin' caseSensitive:true
+     'hello world' includesString:'WOR' caseSensitive:false
     "
 !
 
-includesString:aString caseSensitive:caseSensitive
+indexOfSubCollection:subString startingAt:index ifAbsent:exceptionBlock
+    "find a substring, starting at index. if found, return the index;
+     if not found, return the result of evaluating exceptionBlock.
+     This is a q&d hack - not very efficient"
+
includesString:aString caseSensitive:caseSensitive
     "return true, if a substring is contained in the receiver"
 
     ^ (self indexOfSubCollection:aString startingAt:1 ifAbsent:0 caseSensitive:caseSensitive) ~~ 0
@@ -4571,17 +4294,20 @@
      'hello world' includesString:'WOR' caseSensitive:true
      'hello world' includesString:'WOR' caseSensitive:false
     "
+   ^ startIndex
+        ].
+        caseSensitive ifTrue:[
+            startIndex := self indexOf:firstChar startingAt:(startIndex + 1)
+        ] ifFalse:[
+            startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:(startIndex + 1).
+        ].
+    ].
+    ^ exceptionBlock value
+
+    "Modified: 23.2.1996 / 15:35:15 / cg"
 !
 
-indexOfSubCollection:subString startingAt:index ifAbsent:exceptionBlock
-    "find a substring, starting at index. if found, return the index;
-     if not found, return the result of evaluating exceptionBlock.
-     This is a q&d hack - not very efficient"
-
-    ^ self indexOfSubCollection:subString startingAt:index ifAbsent:exceptionBlock caseSensitive:true.
-!
-
-indexOfSubCollection:subString startingAt:index ifAbsent:exceptionBlock caseSensitive:caseSensitive
+restAfter:keywindexOfSubCollection:subString startingAt:index ifAbsent:exceptionBlock caseSensitive:caseSensitive
     "find a substring, starting at index. if found, return the index;
      if not found, return the result of evaluating exceptionBlock.
      This is a q&d hack - not very efficient"
@@ -4634,9 +4360,7 @@
     ^ exceptionBlock value
 
     "Modified: 23.2.1996 / 15:35:15 / cg"
-!
-
-restAfter:keyword withoutSeparators:strip
+AfterrestAfter:keyword withoutSeparators:strip
     "compare the left of the receiver with keyword,
      if it matches return the right.
      Finally, if strip is true, remove whiteSpace.
@@ -4671,55 +4395,15 @@
     "
 
     "Created: 25.11.1995 / 11:04:18 / cg"
-! !
-
-!CharacterArray methodsFor:'testing'!
-
-continuesWith:aString startingAt:startIndex
+
+
+    "Created: 12.5.1996 / 15:46:40 / cg"
+  continuesWith:aString startingAt:startIndex
     "return true, if the receiver beginning at startIndex
      contains the characters in aString."
 
     |sz  "{Class: SmallInteger }"
-     idx "{Class: SmallInteger }"|
-
-    sz := aString size.
-    idx := startIndex.
-
-    1 to:sz do:[:i |
-	(self at:idx) ~~ (aString at:i) ifTrue:[^ false].
-	idx := idx + 1
-    ].
-    ^ true
-
-    "
-     'hello world' continuesWith:'world' startingAt:6
-     'hello world' continuesWith:'world' startingAt:7
-    "
-
-    "Created: 12.5.1996 / 15:46:40 / cg"
-    "Modified: 26.7.1996 / 19:08:36 / cg"
-!
-
-countWords
-    "return the number of words, which are separated by separators"
-
-    |tally "{ Class: SmallInteger }"
-     start "{ Class: SmallInteger }"
-     mySize "{ Class: SmallInteger }"
-     stop ch|
-
-    tally := 0.
-    start := 1.
-    mySize := self size.
-    [start <= mySize] whileTrue:[
-	ch := self at:start.
-	ch isSeparator ifTrue:[
-	    start := start + 1
-	] ifFalse:[
-	    stop := self indexOfSeparatorStartingAt:start.
-	    (stop == 0) ifTrue:[
-		stop := mySize + 1
-	    ].
+     idx "{Class: SmallInteger }
 	    tally := tally + 1.
 	    start := stop
 	]
@@ -4739,6 +4423,20 @@
     (s := self string) ~~ self ifTrue:[
 	^ s endsWith:aStringOrCharacter
     ].
+    aStringOrCharacter isCcountWords
+    "return the number of words, which are separated by separators"
+
+    |tally "{ Class: SmallInteger }"
+     start "{
+
+endsWith:aStringOrCharacter
+    "return true, if the receiver ends with something, aStringOrCharacter."
+
+    |s|
+
+    (s := self string) ~~ self ifTrue:[
+	^ s endsWith:aStringOrCharacter
+    ].
     aStringOrCharacter isCharacter ifTrue:[
 	^ self last = aStringOrCharacter
     ].
@@ -4751,31 +4449,50 @@
 
     "Modified: 12.5.1996 / 15:49:18 / cg"
 !
-
-isAlphaNumeric
-    "return true, if the receiver is some alphanumeric word;
-     i.e. consists of a letter followed by letters or digits."
+
+
+isBinarySelector
+    "treating the receiver as a message selector, return true if its a binary selector"
+
+    |binopChars|
+
+    (self size > 3) ifTrue:[^ false].
+
+    binopChars := Scanner binarySelectorCharacters.
+    ^ (self conform:[:char | (binopChars includes:char)])
+
+    "
+     'foo:bar:' isBinarySelector
+     #foo:bar: isBinarySelector
+     'hello' isBinarySelector
+     '+' isBinarySelector
+     '|' isBinarySelector
+     '?' isBinarySelsBinarySelector
+     '->' isBinarySelector
+     '<->' isBinarySelector
+     '::' isBinarySelector
+    "
+
+    "Modified: 4.1.1997 / 14:16:14 / cg"
+!
+
+isBlank
+    "return true, if the receiver contains spaces only"
+
+    self do:[:char |
+	char ~~ Character space ifTrue:[^ false].
+    ].
+    ^ true
+!
+
+isNumeric
+    "return true, if the receiver is some numeric word;
+     i.e. consists only of digits."
 
     self size == 0 ifTrue:[
-	"mhmh what is this ?"
 	^ false
     ].
-    (self at:1) isLetter ifFalse:[^ false].
-    self do:[:char |
-	char isLetterOrDigit ifFalse:[^ false].
-    ].
-    ^ true
-
-    "
-     'helloWorld' isAlphaNumeric
-     'foo1234' isAlphaNumeric
-     'f1234' isAlphaNumeric
-     '1234' isAlphaNumeric
-     '+' isAlphaNumeric
-    "
-!
-
-isBinarySelector
+    self do:[:char |isBinarySelector
     "treating the receiver as a message selector, return true if its a binary selector"
 
     |binopChars|
@@ -4800,39 +4517,19 @@
     "
 
     "Modified: 4.1.1997 / 14:16:14 / cg"
-!
-
-isBlank
-    "return true, if the receiver contains spaces only"
-
-    self do:[:char |
-	char ~~ Character space ifTrue:[^ false].
-    ].
-    ^ true
-!
-
-isNumeric
-    "return true, if the receiver is some numeric word;
-     i.e. consists only of digits."
-
-    self size == 0 ifTrue:[
-	^ false
-    ].
-    self do:[:char |
-	char isDigit ifFalse:[^ false].
-    ].
-    ^ true
-
-    "
-     'helloWorld' isNumeric
-     'foo1234' isNumeric
-     'f1234' isNumeric
-     '1234' isNumeric
-     '+' isNumeric
+ocmprt' levenshteinTo:'computer'
+     'computer' levenshteinTo:'computer'
+     'ocmputer' levenshteinTo:'computer'
+     'cmputer' levenshteinTo:'computer'
+     'computer' levenshteinTo:'cmputer'
+     'Computer' levenshteinTo:'computer'
     "
 !
 
-levenshteinTo:aString
+levenshteinTo:aString s:substWeight k:kbdTypoWeight c:caseWeight i:insrtWeight d:deleteWeight
+    "parametrized levenshtein.
+     return the levenshtein distance to the argument, aString;
+     this value corrensponds to the number of replacements that halevenshteinTo:aString
     "return the levenshtein distance to the argument, aString;
      this value corresponds to the number of replacements that have to be
      made to get aString from the receiver.
@@ -4868,9 +4565,7 @@
      'computer' levenshteinTo:'cmputer'
      'Computer' levenshteinTo:'computer'
     "
-!
-
-levenshteinTo:aString s:substWeight k:kbdTypoWeight c:caseWeight i:insrtWeight d:deleteWeight
+ifTrulevenshteinTo:aString s:substWeight k:kbdTypoWeight c:caseWeight i:insrtWeight d:deleteWeight
     "parametrized levenshtein.
      return the levenshtein distance to the argument, aString;
      this value corrensponds to the number of replacements that have to be
@@ -4946,9 +4641,7 @@
     ].
 
     ^ (d at:(len1 + 1)) at:(len2 + 1)
-!
-
-numArgs
+++' nnumArgs
     "treating the receiver as a message selector, return how many arguments would it take"
 
     |binopChars|
@@ -4977,36 +4670,31 @@
     "
 
     "Modified: 4.1.1997 / 14:16:14 / cg"
-!
-
-partsIfSelector
+   #fpartsIfSelector
     "treat the receiver as a message selector, return a collection of parts."
 
-    |idx1 "{ Class: SmallInteger }"
-     coll idx2 sz|
-
-    coll := OrderedCollection new.
-    idx1 := 1.
-    sz := self size.
-    [true] whileTrue:[
-	idx2 := self indexOf:$: startingAt:idx1 + 1.
-	(idx2 == 0 or:[idx2 == sz]) ifTrue:[
-	    coll add:(self copyFrom:idx1).
-	    ^ coll
-	].
-	coll add:(self copyFrom:idx1 to:idx2).
-	idx1 := idx2 + 1
-    ].
-
-    "
-     'foo:bar:' partsIfSelector
-     #foo:bar: partsIfSelector
-     'hello' partsIfSelector
-     '+' partsIfSelector
+    |idx1 "{ Class: SmallInteger }
     "
 !
 
-spellAgainst: aString
+startsWith:aString
+    "return true, if the receiver starts with something, aString.
+     If the argument is empty, true is returned."
+
+    |s|
+
+    (s := self string) ~~ self ifTrue:[
+	^ s startsWith:aString
+    ].
+    ^ super startsWith:aString
+
+    "
+     'hello world' startsWith:'hello'
+     'hello world' asText allBold startsWith:'hello'
+     'hello world' asText allBold startsWith:''
+    "
+
+    "Created: 12.5.199spellAgainst: aString
     "return an integer between 0 and 100 indicating how similar
      the argument is to the receiver.  No case conversion is done.
      This algorithm is much simpler (but also less exact) than the
@@ -5058,9 +4746,9 @@
      'Smalltalk' spellAgainst: 'smalltlk'
      'Smalltalk' spellAgainst: 'Smalltolk'
     "
-!
-
-startsWith:aString
+
+
+sstartsWith:aString
     "return true, if the receiver starts with something, aString.
      If the argument is empty, true is returned."
 
@@ -5081,17 +4769,7 @@
     "Modified: 12.5.1996 / 15:49:24 / cg"
 ! !
 
-!CharacterArray methodsFor:'tracing'!
-
-traceInto:aRequestor level:level from:referrer
-    "double dispatch into tracer, passing my type implicitely in the selector"
-
-    ^ aRequestor traceCharacterArray:self level:level from:referrer
-
-
-! !
-
-!CharacterArray methodsFor:'visiting'!
+!CharacterArray
 
 acceptVisitor:aVisitor with:aParameter
 
@@ -5101,7 +4779,18 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.332 2006-02-20 13:04:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.333 2006-02-23 17:54:32 cg Exp $'
+! !
+
+CharacacceptVisitor:aVisitor with:aParameter
+
+    ^ aVisitor visitString:self with:aParameter
+! !
+
+!CharacterArray class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.333 2006-02-23 17:54:32 cg Exp $'
 ! !
 
 CharacterArray initialize!