CharacterArray.st
changeset 17158 d21b6be88f32
parent 17137 9a31ec4d6489
child 17165 1e2822c3c74c
equal deleted inserted replaced
17157:094fcff6a403 17158:d21b6be88f32
   280     ^ EncodingFailedSignal
   280     ^ EncodingFailedSignal
   281 
   281 
   282     "Modified: 28.6.1997 / 20:09:35 / cg"
   282     "Modified: 28.6.1997 / 20:09:35 / cg"
   283     "Created: 3.8.1997 / 18:16:40 / cg"
   283     "Created: 3.8.1997 / 18:16:40 / cg"
   284 ! !
   284 ! !
   285 
       
   286 
   285 
   287 !CharacterArray class methodsFor:'cleanup'!
   286 !CharacterArray class methodsFor:'cleanup'!
   288 
   287 
   289 lowSpaceCleanup
   288 lowSpaceCleanup
   290     "cleanup in low-memory situations"
   289     "cleanup in low-memory situations"
   723      Abstract subclasses must redefine again."
   722      Abstract subclasses must redefine again."
   724 
   723 
   725     ^ self == CharacterArray
   724     ^ self == CharacterArray
   726 ! !
   725 ! !
   727 
   726 
   728 
       
   729 !CharacterArray methodsFor:'Compatibility-ANSI'!
   727 !CharacterArray methodsFor:'Compatibility-ANSI'!
   730 
   728 
   731 addLineDelimiters
   729 addLineDelimiters
   732     "Ansi compatibility - same as withCRs"
   730     "Ansi compatibility - same as withCRs"
   733 
   731 
  4269 
  4267 
  4270     "Modified: / 11-05-2010 / 19:12:37 / cg"
  4268     "Modified: / 11-05-2010 / 19:12:37 / cg"
  4271 ! !
  4269 ! !
  4272 
  4270 
  4273 
  4271 
  4274 
       
  4275 
       
  4276 !CharacterArray methodsFor:'matching - glob expressions'!
  4272 !CharacterArray methodsFor:'matching - glob expressions'!
  4277 
  4273 
  4278 compoundMatch:aString
  4274 compoundMatch:aString
  4279     "like match, but the receiver may be a compound match pattern,
  4275     "like match, but the receiver may be a compound match pattern,
  4280      consisting of multiple simple GLOB patterns, separated by semicolons.
  4276      consisting of multiple simple GLOB patterns, separated by semicolons.
  4954 
  4950 
  4955     "Created: / 08-03-2012 / 03:11:11 / cg"
  4951     "Created: / 08-03-2012 / 03:11:11 / cg"
  4956 ! !
  4952 ! !
  4957 
  4953 
  4958 
  4954 
  4959 
       
  4960 !CharacterArray methodsFor:'padded copying'!
  4955 !CharacterArray methodsFor:'padded copying'!
  4961 
  4956 
  4962 centerPaddedTo:newSize
  4957 centerPaddedTo:newSize
  4963      "return a new string consisting of the receivers characters,
  4958      "return a new string consisting of the receivers characters,
  4964      plus spaces up to length and center the receivers characters in
  4959      plus spaces up to length and center the receivers characters in
  5124     firstChar := (self at:1) asLowercase.
  5119     firstChar := (self at:1) asLowercase.
  5125     ((firstChar isVowel and:[firstChar ~~ $u]) or:[firstChar == $x]) ifTrue:[
  5120     ((firstChar isVowel and:[firstChar ~~ $u]) or:[firstChar == $x]) ifTrue:[
  5126         ^ 'an'
  5121         ^ 'an'
  5127     ].
  5122     ].
  5128 
  5123 
  5129     "/ exceptions: 3 non-vowels in a row: looks like an abbreviation
       
  5130     (self size >= 3) ifTrue:[
  5124     (self size >= 3) ifTrue:[
  5131         (firstChar isVowel not
  5125         (firstChar isVowel not
  5132         and:[(self at:2) isVowel not       
  5126         and:[(self at:2) isVowel not       
  5133         and:[(self at:3) isVowel not ]]) ifTrue:[
  5127         and:[(self at:3) isVowel not ]]) ifTrue:[
       
  5128             "/ exceptions: 3 non-vowels in a row: looks like an abbreviation
  5134             (self size > 4) ifTrue:[
  5129             (self size > 4) ifTrue:[
  5135                 ((self asLowercase startsWith:'scr') and:[(self at:4) isVowel]) ifTrue:[
  5130                 ((self asLowercase startsWith:'scr') and:[(self at:4) isVowel]) ifTrue:[
  5136                     ^ 'a'
  5131                     ^ 'a'
  5137                 ].
  5132                 ].
  5138             ].
  5133             ].
  5139             ^ 'an'
  5134             "/ an abbreviation; treat x, s as vowels
       
  5135             (firstChar == $x or:[ firstChar == $s ]) ifTrue:[^ 'an'].
  5140         ]
  5136         ]
  5141     ].
  5137     ].
  5142     ^ 'a'
  5138     ^ 'a'
  5143 
  5139 
  5144     "
  5140     "
  5145         'uboot' article.   
  5141         'uboot' article.   
  5146         'xmas' article.    
  5142         'xmas' article.    
  5147         'alarm' article.   
  5143         'alarm' article.     
  5148         'baby' article.    
  5144         'baby' article.      
  5149         'sql' article.  
  5145         'sql' article.       
  5150         'scr' article.   
  5146         'scr' article.       
  5151         'screen' article.  
  5147         'screen' article.    
  5152         'scrollbar' article.  
  5148         'scrollbar' article.  
  5153         'scrs' article.  
  5149         'scrs' article.     
       
  5150         'cvs' article.     
       
  5151         'cvssource' article.     
  5154     "
  5152     "
  5155 !
  5153 !
  5156 
  5154 
  5157 basicStoreString
  5155 basicStoreString
  5158     "return a String for storing myself"
  5156     "return a String for storing myself"
  5603     "
  5601     "
  5604 
  5602 
  5605     "Created: 12.5.1996 / 20:09:29 / cg"
  5603     "Created: 12.5.1996 / 20:09:29 / cg"
  5606     "Modified: 17.4.1997 / 12:50:23 / cg"
  5604     "Modified: 17.4.1997 / 12:50:23 / cg"
  5607 ! !
  5605 ! !
  5608 
       
  5609 
  5606 
  5610 !CharacterArray methodsFor:'special string converting'!
  5607 !CharacterArray methodsFor:'special string converting'!
  5611 
  5608 
  5612 asUnixFilenameString
  5609 asUnixFilenameString
  5613     "return a new string consisting of receiver's characters
  5610     "return a new string consisting of receiver's characters
  6595      ('  ' , Character tab asString , ' foo   ') withoutTrailingSeparators inspect
  6592      ('  ' , Character tab asString , ' foo   ') withoutTrailingSeparators inspect
  6596      ('   foo' , Character tab asString) withoutTrailingSeparators inspect
  6593      ('   foo' , Character tab asString) withoutTrailingSeparators inspect
  6597     "
  6594     "
  6598 ! !
  6595 ! !
  6599 
  6596 
  6600 
       
  6601 !CharacterArray methodsFor:'substring searching'!
  6597 !CharacterArray methodsFor:'substring searching'!
  6602 
  6598 
  6603 findRangeOfString:subString
  6599 findRangeOfString:subString
  6604     "find a substring. if found, return the start- and endIndex;
  6600     "find a substring. if found, return the start- and endIndex;
  6605      if not found, return an empty interval."
  6601      if not found, return an empty interval."
  7179     "dispatch for visitor pattern; send #visitString:with: to aVisitor"
  7175     "dispatch for visitor pattern; send #visitString:with: to aVisitor"
  7180 
  7176 
  7181     ^ aVisitor visitString:self with:aParameter
  7177     ^ aVisitor visitString:self with:aParameter
  7182 ! !
  7178 ! !
  7183 
  7179 
  7184 
       
  7185 !CharacterArray class methodsFor:'documentation'!
  7180 !CharacterArray class methodsFor:'documentation'!
  7186 
  7181 
  7187 version
  7182 version
  7188     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.553 2014-11-26 19:29:35 cg Exp $'
  7183     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.554 2014-11-28 15:15:26 cg Exp $'
  7189 !
  7184 !
  7190 
  7185 
  7191 version_CVS
  7186 version_CVS
  7192     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.553 2014-11-26 19:29:35 cg Exp $'
  7187     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.554 2014-11-28 15:15:26 cg Exp $'
  7193 ! !
  7188 ! !
  7194 
  7189 
  7195 
  7190 
  7196 CharacterArray initialize!
  7191 CharacterArray initialize!