String.st
branchjv
changeset 20728 83c74234945e
parent 20727 fb8c5591428b
parent 20688 eb8babbd8d57
child 21024 8734987eb5c7
equal deleted inserted replaced
20727:fb8c5591428b 20728:83c74234945e
   517     ].
   517     ].
   518     ^ TAB
   518     ^ TAB
   519 ! !
   519 ! !
   520 
   520 
   521 
   521 
       
   522 
       
   523 
   522 !String class methodsFor:'queries'!
   524 !String class methodsFor:'queries'!
   523 
   525 
   524 defaultPlatformClass
   526 defaultPlatformClass
   525     "dummy for ST-80 compatibility"
   527     "dummy for ST-80 compatibility"
   526 
   528 
   535 
   537 
   536     ^ self == String
   538     ^ self == String
   537 
   539 
   538     "Modified: 23.4.1996 / 16:00:38 / cg"
   540     "Modified: 23.4.1996 / 16:00:38 / cg"
   539 ! !
   541 ! !
       
   542 
       
   543 
       
   544 
       
   545 
       
   546 
   540 
   547 
   541 
   548 
   542 !String methodsFor:'accessing'!
   549 !String methodsFor:'accessing'!
   543 
   550 
   544 at:index
   551 at:index
  2410     ^ super ~= aString
  2417     ^ super ~= aString
  2411 ! !
  2418 ! !
  2412 
  2419 
  2413 !String methodsFor:'converting'!
  2420 !String methodsFor:'converting'!
  2414 
  2421 
  2415 asArrayOfSubstrings
       
  2416     "Answer an array with all the substrings of the receiver separated by
       
  2417      separator characters (space, cr, tab, linefeed, formfeed, etc).
       
  2418      CG: This is ported Squeak code, and I am not sure if it is more efficient than
       
  2419 	 the inherited one... after all: who added it anyway ?"
       
  2420 
       
  2421     | substrings start end stop |
       
  2422 
       
  2423     substrings := OrderedCollection new.
       
  2424     start := 1.
       
  2425     stop := self size.
       
  2426     [start <= stop] whileTrue: [
       
  2427 	(self at: start) isSeparator ifFalse: [
       
  2428 	    end := start + 1.
       
  2429 	    [end <= stop and: [(self at: end) isSeparator not]]
       
  2430 		whileTrue: [end := end + 1].
       
  2431 	    substrings add: (self copyFrom: start to: end - 1).
       
  2432 	    start := end - 1
       
  2433 	].
       
  2434 	start := start + 1
       
  2435     ].
       
  2436     ^ substrings asArray
       
  2437 !
       
  2438 
       
  2439 asAsciiZ
  2422 asAsciiZ
  2440     "if the receiver does not end with a 0-valued character, return a copy of it,
  2423     "if the receiver does not end with a 0-valued character, return a copy of it,
  2441      with an additional 0-character. Otherwise return the receiver. This is sometimes
  2424      with an additional 0-character. Otherwise return the receiver. This is sometimes
  2442      needed when a string has to be passed to C, which needs 0-terminated strings.
  2425      needed when a string has to be passed to C, which needs 0-terminated strings.
  2443      Notice, that all singleByte strings are already 0-terminated in ST/X, whereas wide
  2426      Notice, that all singleByte strings are already 0-terminated in ST/X, whereas wide
  4274     #endif
  4257     #endif
  4275 %}.
  4258 %}.
  4276     ^ super reverse
  4259     ^ super reverse
  4277 ! !
  4260 ! !
  4278 
  4261 
       
  4262 
  4279 !String methodsFor:'substring searching'!
  4263 !String methodsFor:'substring searching'!
  4280 
  4264 
  4281 indexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue caseSensitive:caseSensitive
  4265 indexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue caseSensitive:caseSensitive
  4282     "redefined as primitive for maximum speed (BM)"
  4266     "redefined as primitive for maximum speed (BM)"
  4283 
  4267 
  4950     ^ aRequestor traceString:self level:level from:referrer
  4934     ^ aRequestor traceString:self level:level from:referrer
  4951 
  4935 
  4952 
  4936 
  4953 ! !
  4937 ! !
  4954 
  4938 
       
  4939 
  4955 !String class methodsFor:'documentation'!
  4940 !String class methodsFor:'documentation'!
  4956 
  4941 
  4957 version
  4942 version
  4958     ^ '$Header$'
  4943     ^ '$Header$'
  4959 !
  4944 !