CharacterArray.st
changeset 15167 62b89f82633c
parent 15055 99961534feb1
child 15196 116b287d6d89
child 18054 56594a8c6b83
equal deleted inserted replaced
15166:6dd961ea0806 15167:62b89f82633c
   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 
   285 
       
   286 
   286 !CharacterArray class methodsFor:'cleanup'!
   287 !CharacterArray class methodsFor:'cleanup'!
   287 
   288 
   288 lowSpaceCleanup
   289 lowSpaceCleanup
   289     "cleanup in low-memory situations"
   290     "cleanup in low-memory situations"
   290 
   291 
   323    invalid:
   324    invalid:
   324      CharacterArray fromUTF8Bytes:#[ 16rC0 16r80 ]
   325      CharacterArray fromUTF8Bytes:#[ 16rC0 16r80 ]
   325      CharacterArray fromUTF8Bytes:#[ 16rE0 16r80 16r80 ]
   326      CharacterArray fromUTF8Bytes:#[ 16rE0 16r80 16r80 ]
   326     "
   327     "
   327 ! !
   328 ! !
       
   329 
   328 
   330 
   329 !CharacterArray class methodsFor:'pattern matching'!
   331 !CharacterArray class methodsFor:'pattern matching'!
   330 
   332 
   331 matchEscapeCharacter
   333 matchEscapeCharacter
   332     "return the character used to escape a matchCharacter
   334     "return the character used to escape a matchCharacter
  2482 
  2484 
  2483     |lines|
  2485     |lines|
  2484 
  2486 
  2485     lines := self asCollectionOfSubstringsSeparatedBy:Character cr.
  2487     lines := self asCollectionOfSubstringsSeparatedBy:Character cr.
  2486     lines last isEmpty ifTrue:[
  2488     lines last isEmpty ifTrue:[
  2487         ^ lines copyWithoutLast:1
  2489         ^ lines copyButLast:1
  2488     ].
  2490     ].
  2489     ^ lines
  2491     ^ lines
  2490 
  2492 
  2491     "
  2493     "
  2492      '1\2\3' withCRs asCollectionOfLines
  2494      '1\2\3' withCRs asCollectionOfLines
  3946 
  3948 
  3947     "Modified: / 11-05-2010 / 19:12:37 / cg"
  3949     "Modified: / 11-05-2010 / 19:12:37 / cg"
  3948 ! !
  3950 ! !
  3949 
  3951 
  3950 
  3952 
       
  3953 
       
  3954 
  3951 !CharacterArray methodsFor:'matching - glob expressions'!
  3955 !CharacterArray methodsFor:'matching - glob expressions'!
  3952 
  3956 
  3953 compoundMatch:aString
  3957 compoundMatch:aString
  3954     "like match, but the receiver may be a compound match pattern,
  3958     "like match, but the receiver may be a compound match pattern,
  3955      consisting of multiple simple GLOB patterns, separated by semicolons.
  3959      consisting of multiple simple GLOB patterns, separated by semicolons.
  4388 
  4392 
  4389     ^ aPatternString match:self ignoreCase:ignoreCase
  4393     ^ aPatternString match:self ignoreCase:ignoreCase
  4390 
  4394 
  4391     "Created: / 08-03-2012 / 03:11:11 / cg"
  4395     "Created: / 08-03-2012 / 03:11:11 / cg"
  4392 ! !
  4396 ! !
       
  4397 
  4393 
  4398 
  4394 
  4399 
  4395 !CharacterArray methodsFor:'padded copying'!
  4400 !CharacterArray methodsFor:'padded copying'!
  4396 
  4401 
  4397 centerPaddedTo:newSize
  4402 centerPaddedTo:newSize
  4913     "
  4918     "
  4914 
  4919 
  4915     "Created: 12.5.1996 / 20:09:29 / cg"
  4920     "Created: 12.5.1996 / 20:09:29 / cg"
  4916     "Modified: 17.4.1997 / 12:50:23 / cg"
  4921     "Modified: 17.4.1997 / 12:50:23 / cg"
  4917 ! !
  4922 ! !
       
  4923 
  4918 
  4924 
  4919 !CharacterArray methodsFor:'special string converting'!
  4925 !CharacterArray methodsFor:'special string converting'!
  4920 
  4926 
  4921 expandPlaceholders:escapeCharacter with:argArrayOrDictionary
  4927 expandPlaceholders:escapeCharacter with:argArrayOrDictionary
  4922     "this is the generic version of the old %-escaping method, allowing for an arbitrary
  4928     "this is the generic version of the old %-escaping method, allowing for an arbitrary
  5789 
  5795 
  5790     |result quote|
  5796     |result quote|
  5791 
  5797 
  5792     result := self.
  5798     result := self.
  5793     ((result startsWith:$") or:[(result startsWith:$')]) ifTrue:[
  5799     ((result startsWith:$") or:[(result startsWith:$')]) ifTrue:[
  5794 	quote := result at:1.
  5800         quote := result at:1.
  5795 	result := result copyFrom:2.
  5801         result := result copyFrom:2.
  5796 	(result endsWith:quote) ifTrue:[
  5802         (result endsWith:quote) ifTrue:[
  5797 	    result := result copyWithoutLast:1
  5803             result := result copyButLast:1
  5798 	].
  5804         ].
  5799     ].
  5805     ].
  5800     ^ result
  5806     ^ result
  5801 
  5807 
  5802 "/    '"hello"' withoutQuotes
  5808 "/    '"hello"' withoutQuotes
  5803 "/    '''hello''' withoutQuotes
  5809 "/    '''hello''' withoutQuotes
  5855      'foo'         withoutTrailingSeparators
  5861      'foo'         withoutTrailingSeparators
  5856      ('  ' , Character tab asString , ' foo   ') withoutTrailingSeparators inspect
  5862      ('  ' , Character tab asString , ' foo   ') withoutTrailingSeparators inspect
  5857      ('   foo' , Character tab asString) withoutTrailingSeparators inspect
  5863      ('   foo' , Character tab asString) withoutTrailingSeparators inspect
  5858     "
  5864     "
  5859 ! !
  5865 ! !
       
  5866 
  5860 
  5867 
  5861 !CharacterArray methodsFor:'substring searching'!
  5868 !CharacterArray methodsFor:'substring searching'!
  5862 
  5869 
  5863 findRangeOfString:subString
  5870 findRangeOfString:subString
  5864     "find a substring. if found, return the start- and endIndex;
  5871     "find a substring. if found, return the start- and endIndex;
  6377 ! !
  6384 ! !
  6378 
  6385 
  6379 !CharacterArray class methodsFor:'documentation'!
  6386 !CharacterArray class methodsFor:'documentation'!
  6380 
  6387 
  6381 version
  6388 version
  6382     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.499 2013-04-03 19:12:25 cg Exp $'
  6389     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.500 2013-04-25 13:12:04 stefan Exp $'
  6383 !
  6390 !
  6384 
  6391 
  6385 version_CVS
  6392 version_CVS
  6386     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.499 2013-04-03 19:12:25 cg Exp $'
  6393     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.500 2013-04-25 13:12:04 stefan Exp $'
  6387 ! !
  6394 ! !
  6388 
  6395 
  6389 
  6396 
  6390 CharacterArray initialize!
  6397 CharacterArray initialize!