CharacterArray.st
changeset 11823 614c2195da0f
parent 11788 eea1835a1b7b
child 11828 b7fc2ba68121
equal deleted inserted replaced
11822:9253f9960566 11823:614c2195da0f
  1666 isCharacters
  1666 isCharacters
  1667     "added for visual works compatibility"
  1667     "added for visual works compatibility"
  1668     ^ true
  1668     ^ true
  1669 ! !
  1669 ! !
  1670 
  1670 
  1671 
       
  1672 !CharacterArray methodsFor:'character searching'!
  1671 !CharacterArray methodsFor:'character searching'!
  1673 
  1672 
  1674 includesMatchCharacters
  1673 includesMatchCharacters
  1675     "return true if the receiver includes any meta characters (i.e. $* or $#)
  1674     "return true if the receiver includes any meta characters (i.e. $* or $#)
  1676      for match operations; false if not.
  1675      for match operations; false if not.
  4355     "
  4354     "
  4356 
  4355 
  4357     "Created: 12.5.1996 / 20:09:29 / cg"
  4356     "Created: 12.5.1996 / 20:09:29 / cg"
  4358     "Modified: 17.4.1997 / 12:50:23 / cg"
  4357     "Modified: 17.4.1997 / 12:50:23 / cg"
  4359 ! !
  4358 ! !
  4360 
       
  4361 
  4359 
  4362 !CharacterArray methodsFor:'special string converting'!
  4360 !CharacterArray methodsFor:'special string converting'!
  4363 
  4361 
  4364 expandPlaceholdersWith:argArrayOrDictionary
  4362 expandPlaceholdersWith:argArrayOrDictionary
  4365     "return a copy of the receiver, where all %i escapes are
  4363     "return a copy of the receiver, where all %i escapes are
  5163     "
  5161     "
  5164      'hello world' includesString:'hel'   
  5162      'hello world' includesString:'hel'   
  5165      'hello world' includesString:'rld'
  5163      'hello world' includesString:'rld'
  5166      'hello world' includesString:'llo'
  5164      'hello world' includesString:'llo'
  5167      'hello world' includesString:'LLO'
  5165      'hello world' includesString:'LLO'
       
  5166      'hello world' includesString:'' 
  5168     "
  5167     "
  5169 !
  5168 !
  5170 
  5169 
  5171 includesString:aString caseSensitive:caseSensitive
  5170 includesString:aString caseSensitive:caseSensitive
  5172     "return true, if a substring is contained in the receiver"
  5171     "return true, if a substring is contained in the receiver"
  5203      mySize     "{ Class: SmallInteger }"
  5202      mySize     "{ Class: SmallInteger }"
  5204      runIdx     "{ Class: SmallInteger }"
  5203      runIdx     "{ Class: SmallInteger }"
  5205      tester|
  5204      tester|
  5206 
  5205 
  5207     subSize := subString size.
  5206     subSize := subString size.
  5208     subSize == 0 ifTrue:[   "empty string matches"
  5207     subSize == 0 ifTrue:[   
  5209         subString isString ifFalse:[
  5208         subString isString ifFalse:[
  5210            self error:'non string argument' mayProceed:true.
  5209            self error:'non string argument' mayProceed:true.
  5211         ].
  5210         ].
       
  5211         "empty string does not match"
       
  5212         ^ 0.
       
  5213         "empty string matches"
  5212         ^ index
  5214         ^ index
  5213     ].
  5215     ].
  5214     tester := caseSensitive ifTrue:[ [:c1 :c2 | c1 = c2 ] ] ifFalse:[ [:c1 :c2 | c1 sameAs: c2 ] ].
  5216     tester := caseSensitive 
       
  5217                 ifTrue:[  [:c1 :c2 | c1 = c2 ]  ] 
       
  5218                 ifFalse:[ [:c1 :c2 | c1 sameAs: c2 ] ].
  5215 
  5219 
  5216     mySize := self size.
  5220     mySize := self size.
  5217     firstChar := subString at:1.
  5221     firstChar := subString at:1.
  5218     caseSensitive ifTrue:[
  5222     caseSensitive ifTrue:[
  5219         startIndex := self indexOf:firstChar startingAt:index.
  5223         startIndex := self indexOf:firstChar startingAt:index.
  5768 ! !
  5772 ! !
  5769 
  5773 
  5770 !CharacterArray class methodsFor:'documentation'!
  5774 !CharacterArray class methodsFor:'documentation'!
  5771 
  5775 
  5772 version
  5776 version
  5773     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.397 2009-06-30 12:03:08 stefan Exp $'
  5777     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.398 2009-07-30 10:32:25 cg Exp $'
  5774 ! !
  5778 ! !
  5775 
  5779 
  5776 CharacterArray initialize!
  5780 CharacterArray initialize!