CharacterArray.st
changeset 15055 99961534feb1
parent 15035 ecbb70df7a5c
child 15167 62b89f82633c
child 18045 c0c600e0d3b3
equal deleted inserted replaced
15054:1667e3fe9e8b 15055:99961534feb1
   675      Abstract subclasses must redefine again."
   675      Abstract subclasses must redefine again."
   676 
   676 
   677     ^ self == CharacterArray
   677     ^ self == CharacterArray
   678 ! !
   678 ! !
   679 
   679 
       
   680 
   680 !CharacterArray methodsFor:'Compatibility-ANSI'!
   681 !CharacterArray methodsFor:'Compatibility-ANSI'!
   681 
   682 
   682 addLineDelimiters
   683 addLineDelimiters
   683     "Ansi compatibility - same as withCRs"
   684     "Ansi compatibility - same as withCRs"
   684 
   685 
  4912     "
  4913     "
  4913 
  4914 
  4914     "Created: 12.5.1996 / 20:09:29 / cg"
  4915     "Created: 12.5.1996 / 20:09:29 / cg"
  4915     "Modified: 17.4.1997 / 12:50:23 / cg"
  4916     "Modified: 17.4.1997 / 12:50:23 / cg"
  4916 ! !
  4917 ! !
  4917 
       
  4918 
  4918 
  4919 !CharacterArray methodsFor:'special string converting'!
  4919 !CharacterArray methodsFor:'special string converting'!
  4920 
  4920 
  4921 expandPlaceholders:escapeCharacter with:argArrayOrDictionary
  4921 expandPlaceholders:escapeCharacter with:argArrayOrDictionary
  4922     "this is the generic version of the old %-escaping method, allowing for an arbitrary
  4922     "this is the generic version of the old %-escaping method, allowing for an arbitrary
  5858     "
  5858     "
  5859 ! !
  5859 ! !
  5860 
  5860 
  5861 !CharacterArray methodsFor:'substring searching'!
  5861 !CharacterArray methodsFor:'substring searching'!
  5862 
  5862 
       
  5863 findRangeOfString:subString
       
  5864     "find a substring. if found, return the start- and endIndex;
       
  5865      if not found, return an empty interval."
       
  5866 
       
  5867     ^ self rangeOfSubCollection:subString startingAt:1 ifAbsent:[0 to:-1] caseSensitive:true
       
  5868 
       
  5869     "
       
  5870      'hello world' findRangeOfString:'llo'
       
  5871      'hello world' findRangeOfString:'ole'
       
  5872     "
       
  5873 !
       
  5874 
  5863 findString:subString
  5875 findString:subString
  5864     "find a substring. if found, return the index;
  5876     "find a substring. if found, return the index;
  5865      if not found, return 0."
  5877      if not found, return 0."
  5866 
  5878 
  5867     ^ self indexOfSubCollection:subString startingAt:1 ifAbsent:0 caseSensitive:true
  5879     ^ self indexOfSubCollection:subString startingAt:1 ifAbsent:0 caseSensitive:true
  6014     ^ exceptionBlock value
  6026     ^ exceptionBlock value
  6015 
  6027 
  6016     "Modified: 23.2.1996 / 15:35:15 / cg"
  6028     "Modified: 23.2.1996 / 15:35:15 / cg"
  6017 !
  6029 !
  6018 
  6030 
       
  6031 rangeOfSubCollection:subString startingAt:start ifAbsent:exceptionValue caseSensitive:caseSensitive
       
  6032     "find a substring. if found, return the start- and endIndex;
       
  6033      if not found, return the value of exceptionValue."
       
  6034 
       
  6035     |i|
       
  6036 
       
  6037     i := self indexOfSubCollection:subString startingAt:start ifAbsent:0 caseSensitive:caseSensitive.
       
  6038     i == 0 ifTrue:[
       
  6039         ^ exceptionValue value
       
  6040     ].
       
  6041     ^ i to:(i + subString size - 1)
       
  6042 
       
  6043     "
       
  6044      'hello world' findRangeOfString:'llo'
       
  6045      'hello world' findRangeOfString:'ole'
       
  6046     "
       
  6047 !
       
  6048 
  6019 restAfter:keyword withoutSeparators:strip
  6049 restAfter:keyword withoutSeparators:strip
  6020     "compare the left of the receiver with keyword,
  6050     "compare the left of the receiver with keyword,
  6021      if it matches return the right.
  6051      if it matches return the right.
  6022      Finally, if strip is true, remove whiteSpace.
  6052      Finally, if strip is true, remove whiteSpace.
  6023      This method is used to match and extract lines of the form:
  6053      This method is used to match and extract lines of the form:
  6347 ! !
  6377 ! !
  6348 
  6378 
  6349 !CharacterArray class methodsFor:'documentation'!
  6379 !CharacterArray class methodsFor:'documentation'!
  6350 
  6380 
  6351 version
  6381 version
  6352     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.498 2013-04-02 16:06:34 cg Exp $'
  6382     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.499 2013-04-03 19:12:25 cg Exp $'
  6353 !
  6383 !
  6354 
  6384 
  6355 version_CVS
  6385 version_CVS
  6356     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.498 2013-04-02 16:06:34 cg Exp $'
  6386     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.499 2013-04-03 19:12:25 cg Exp $'
  6357 ! !
  6387 ! !
  6358 
  6388 
  6359 
  6389 
  6360 CharacterArray initialize!
  6390 CharacterArray initialize!