CharacterArray.st
changeset 23001 92776085244b
parent 22999 c3bafb980bf4
child 23009 c3309c64390e
equal deleted inserted replaced
23000:5760bcf5994e 23001:92776085244b
  4501             left := left withoutSeparators.
  4501             left := left withoutSeparators.
  4502             right := right withoutSeparators.
  4502             right := right withoutSeparators.
  4503         ].
  4503         ].
  4504         ^ StringCollection with:left with:right
  4504         ^ StringCollection with:left with:right
  4505     ].
  4505     ].
  4506     self error:'substring not present in receiver' mayProceed:true.
  4506     self proceedableError:'substring not present in receiver'.
  4507     ^ self
  4507     ^ self
  4508 
  4508 
  4509     "
  4509     "
  4510      'hello -> world' splitAtString:'->' withoutSeparators:false
  4510      'hello -> world' splitAtString:'->' withoutSeparators:false
  4511      'hello -> world' splitAtString:'->' withoutSeparators:true
  4511      'hello -> world' splitAtString:'->' withoutSeparators:true
  4512      'hello -> ' splitAtString:'->' withoutSeparators:true
  4512      'hello -> ' splitAtString:'->' withoutSeparators:true
  4513      'hello > error' splitAtString:'->' withoutSeparators:true
  4513      'hello > error' splitAtString:'->' withoutSeparators:true
  4514     "
  4514     "
  4515 
  4515 
  4516     "Created: 25.11.1995 / 11:04:18 / cg"
  4516     "Created: / 25-11-1995 / 11:04:18 / cg"
       
  4517     "Modified: / 24-05-2018 / 14:55:52 / Claus Gittinger"
  4517 ! !
  4518 ! !
  4518 
  4519 
  4519 !CharacterArray methodsFor:'displaying'!
  4520 !CharacterArray methodsFor:'displaying'!
  4520 
  4521 
  4521 displayOn:aGC x:x y:y from:start to:stop
  4522 displayOn:aGC x:x y:y from:start to:stop
  7791      runIdx     "{ Class: SmallInteger }"|
  7792      runIdx     "{ Class: SmallInteger }"|
  7792 
  7793 
  7793     subSize := subString size.
  7794     subSize := subString size.
  7794     subSize == 0 ifTrue:[
  7795     subSize == 0 ifTrue:[
  7795         subString isString ifFalse:[
  7796         subString isString ifFalse:[
  7796            self error:'non string argument' mayProceed:true.
  7797            self proceedableError:'non string argument'.
  7797         ].
  7798         ].
  7798         "empty string does not match"
  7799         "empty string does not match"
  7799         ^ 0.
  7800         ^ 0.
  7800         "empty string matches"
  7801         "empty string matches"
  7801 "/        ^ index
  7802 "/        ^ index
  7839         'АБВГДЕЖ' indexOfSubCollection:'ВГДЕ' startingAt:1 ifAbsent:nil caseSensitive:true.
  7840         'АБВГДЕЖ' indexOfSubCollection:'ВГДЕ' startingAt:1 ifAbsent:nil caseSensitive:true.
  7840     "
  7841     "
  7841 
  7842 
  7842     "Modified: / 23-02-1996 / 15:35:15 / cg"
  7843     "Modified: / 23-02-1996 / 15:35:15 / cg"
  7843     "Modified (comment): / 28-03-2017 / 16:05:48 / stefan"
  7844     "Modified (comment): / 28-03-2017 / 16:05:48 / stefan"
       
  7845     "Modified: / 24-05-2018 / 14:55:38 / Claus Gittinger"
  7844 !
  7846 !
  7845 
  7847 
  7846 indexOfSubCollection:subString startingAt:index ifAbsent:exceptionBlock caseSensitive:caseSensitive ignoreDiacritics:ignoreDiacritics
  7848 indexOfSubCollection:subString startingAt:index ifAbsent:exceptionBlock caseSensitive:caseSensitive ignoreDiacritics:ignoreDiacritics
  7847     "find a substring, starting at index. if found, return the index;
  7849     "find a substring, starting at index. if found, return the index;
  7848      if not found, return the result of evaluating exceptionBlock.
  7850      if not found, return the result of evaluating exceptionBlock.
  7857      tester charMap firstCharMapped findNextIndex|
  7859      tester charMap firstCharMapped findNextIndex|
  7858 
  7860 
  7859     subSize := subString size.
  7861     subSize := subString size.
  7860     subSize == 0 ifTrue:[
  7862     subSize == 0 ifTrue:[
  7861         subString isString ifFalse:[
  7863         subString isString ifFalse:[
  7862            self error:'non string argument' mayProceed:true.
  7864            self proceedableError:'non string argument'.
  7863         ].
  7865         ].
  7864         "empty string does not match"
  7866         "empty string does not match"
  7865         ^ 0.
  7867         ^ 0.
  7866         "empty string matches"
  7868         "empty string matches"
  7867 "/        ^ index
  7869 "/        ^ index
  7913      'bla depot bla dépots' indexOfSubCollection:'dep' startingAt:6 ifAbsent:0 caseSensitive:false ignoreDiacritics:true. 0
  7915      'bla depot bla dépots' indexOfSubCollection:'dep' startingAt:6 ifAbsent:0 caseSensitive:false ignoreDiacritics:true. 0
  7914 
  7916 
  7915      'bla depot bla dépots' indexOfSubCollection:'dep' startingAt:1 ifAbsent:0 caseSensitive:false ignoreDiacritics:false. 5
  7917      'bla depot bla dépots' indexOfSubCollection:'dep' startingAt:1 ifAbsent:0 caseSensitive:false ignoreDiacritics:false. 5
  7916      'bla depot bla dépots' indexOfSubCollection:'dep' startingAt:6 ifAbsent:0 caseSensitive:false ignoreDiacritics:false. 0
  7918      'bla depot bla dépots' indexOfSubCollection:'dep' startingAt:6 ifAbsent:0 caseSensitive:false ignoreDiacritics:false. 0
  7917     "
  7919     "
       
  7920 
       
  7921     "Modified: / 24-05-2018 / 14:55:43 / Claus Gittinger"
  7918 !
  7922 !
  7919 
  7923 
  7920 lastIndexOfString:aString
  7924 lastIndexOfString:aString
  7921     "VSE and V'age compatibility"
  7925     "VSE and V'age compatibility"
  7922     "find the last occurrence of substring.
  7926     "find the last occurrence of substring.