CharacterArray.st
changeset 16733 3f4622673efc
parent 16697 c462faf821b7
child 16738 bd9416219f7c
equal deleted inserted replaced
16732:4ba89483ebfa 16733:3f4622673efc
   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 
       
   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"
   291 
   290 
   324    invalid:
   323    invalid:
   325      CharacterArray fromUTF8Bytes:#[ 16rC0 16r80 ]
   324      CharacterArray fromUTF8Bytes:#[ 16rC0 16r80 ]
   326      CharacterArray fromUTF8Bytes:#[ 16rE0 16r80 16r80 ]
   325      CharacterArray fromUTF8Bytes:#[ 16rE0 16r80 16r80 ]
   327     "
   326     "
   328 ! !
   327 ! !
   329 
       
   330 
   328 
   331 !CharacterArray class methodsFor:'pattern matching'!
   329 !CharacterArray class methodsFor:'pattern matching'!
   332 
   330 
   333 matchEscapeCharacter
   331 matchEscapeCharacter
   334     "return the character used to escape a matchCharacter
   332     "return the character used to escape a matchCharacter
   723      Abstract subclasses must redefine again."
   721      Abstract subclasses must redefine again."
   724 
   722 
   725     ^ self == CharacterArray
   723     ^ self == CharacterArray
   726 ! !
   724 ! !
   727 
   725 
   728 
       
   729 !CharacterArray methodsFor:'Compatibility-ANSI'!
   726 !CharacterArray methodsFor:'Compatibility-ANSI'!
   730 
   727 
   731 addLineDelimiters
   728 addLineDelimiters
   732     "Ansi compatibility - same as withCRs"
   729     "Ansi compatibility - same as withCRs"
   733 
   730 
  4121 
  4118 
  4122     "Modified: / 11-05-2010 / 19:12:37 / cg"
  4119     "Modified: / 11-05-2010 / 19:12:37 / cg"
  4123 ! !
  4120 ! !
  4124 
  4121 
  4125 
  4122 
  4126 
       
  4127 
       
  4128 !CharacterArray methodsFor:'matching - glob expressions'!
  4123 !CharacterArray methodsFor:'matching - glob expressions'!
  4129 
  4124 
  4130 compoundMatch:aString
  4125 compoundMatch:aString
  4131     "like match, but the receiver may be a compound match pattern,
  4126     "like match, but the receiver may be a compound match pattern,
  4132      consisting of multiple simple GLOB patterns, separated by semicolons.
  4127      consisting of multiple simple GLOB patterns, separated by semicolons.
  4804 
  4799 
  4805     ^ aPatternString match:self caseSensitive:ignoreCase not
  4800     ^ aPatternString match:self caseSensitive:ignoreCase not
  4806 
  4801 
  4807     "Created: / 08-03-2012 / 03:11:11 / cg"
  4802     "Created: / 08-03-2012 / 03:11:11 / cg"
  4808 ! !
  4803 ! !
  4809 
       
  4810 
  4804 
  4811 
  4805 
  4812 !CharacterArray methodsFor:'padded copying'!
  4806 !CharacterArray methodsFor:'padded copying'!
  4813 
  4807 
  4814 centerPaddedTo:newSize
  4808 centerPaddedTo:newSize
  5434     "
  5428     "
  5435 
  5429 
  5436     "Created: 12.5.1996 / 20:09:29 / cg"
  5430     "Created: 12.5.1996 / 20:09:29 / cg"
  5437     "Modified: 17.4.1997 / 12:50:23 / cg"
  5431     "Modified: 17.4.1997 / 12:50:23 / cg"
  5438 ! !
  5432 ! !
  5439 
       
  5440 
  5433 
  5441 !CharacterArray methodsFor:'special string converting'!
  5434 !CharacterArray methodsFor:'special string converting'!
  5442 
  5435 
  5443 expandPlaceholders:escapeCharacter with:argArrayOrDictionary
  5436 expandPlaceholders:escapeCharacter with:argArrayOrDictionary
  5444     "this is the generic version of the old %-escaping method, allowing for an arbitrary
  5437     "this is the generic version of the old %-escaping method, allowing for an arbitrary
  6382      ('  ' , Character tab asString , ' foo   ') withoutTrailingSeparators inspect
  6375      ('  ' , Character tab asString , ' foo   ') withoutTrailingSeparators inspect
  6383      ('   foo' , Character tab asString) withoutTrailingSeparators inspect
  6376      ('   foo' , Character tab asString) withoutTrailingSeparators inspect
  6384     "
  6377     "
  6385 ! !
  6378 ! !
  6386 
  6379 
  6387 
       
  6388 !CharacterArray methodsFor:'substring searching'!
  6380 !CharacterArray methodsFor:'substring searching'!
  6389 
  6381 
  6390 findRangeOfString:subString
  6382 findRangeOfString:subString
  6391     "find a substring. if found, return the start- and endIndex;
  6383     "find a substring. if found, return the start- and endIndex;
  6392      if not found, return an empty interval."
  6384      if not found, return an empty interval."
  6778      For example, the #+ selector as seen by the Foo namespace would be actually #':Foo::+'.
  6770      For example, the #+ selector as seen by the Foo namespace would be actually #':Foo::+'.
  6779      You cannot easily change this algorithm here, as it is also known by the VM's lookup function."
  6771      You cannot easily change this algorithm here, as it is also known by the VM's lookup function."
  6780 
  6772 
  6781     |i|
  6773     |i|
  6782 
  6774 
  6783     (self first == $:) ifFalse:[^ false].
  6775     (self at:1) == $: ifFalse:[^ false].
  6784     i := self indexOf:$: startingAt:2.
  6776     i := self indexOf:$: startingAt:2.
  6785     i == 0 ifTrue:[^ false].
  6777     i == 0 ifTrue:[^ false].
  6786     self size <= (i+1) ifTrue:[^ false].
  6778     self size <= (i+1) ifTrue:[^ false].
  6787     (self at:i+1) == $: ifFalse:[^ false].
  6779     (self at:i+1) == $: ifFalse:[^ false].
  6788     (self at:i+2) == $: ifTrue:[^ false].
  6780     (self at:i+2) == $: ifTrue:[^ false].
  6961 ! !
  6953 ! !
  6962 
  6954 
  6963 !CharacterArray methodsFor:'visiting'!
  6955 !CharacterArray methodsFor:'visiting'!
  6964 
  6956 
  6965 acceptVisitor:aVisitor with:aParameter
  6957 acceptVisitor:aVisitor with:aParameter
       
  6958     "dispatch for visitor pattern; send #visitString:with: to aVisitor"
  6966 
  6959 
  6967     ^ aVisitor visitString:self with:aParameter
  6960     ^ aVisitor visitString:self with:aParameter
  6968 ! !
  6961 ! !
  6969 
  6962 
  6970 
       
  6971 !CharacterArray class methodsFor:'documentation'!
  6963 !CharacterArray class methodsFor:'documentation'!
  6972 
  6964 
  6973 version
  6965 version
  6974     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.535 2014-07-08 20:48:38 cg Exp $'
  6966     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.536 2014-07-09 16:21:21 cg Exp $'
  6975 !
  6967 !
  6976 
  6968 
  6977 version_CVS
  6969 version_CVS
  6978     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.535 2014-07-08 20:48:38 cg Exp $'
  6970     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.536 2014-07-09 16:21:21 cg Exp $'
  6979 ! !
  6971 ! !
  6980 
  6972 
  6981 
  6973 
  6982 CharacterArray initialize!
  6974 CharacterArray initialize!