String.st
changeset 24478 5138e2ba3e6c
parent 24233 9db9068aed81
child 24493 589d9404da3d
equal deleted inserted replaced
24477:7d55efcdd7b2 24478:5138e2ba3e6c
   137 "
   137 "
   138     Strings are ByteArrays storing Characters.
   138     Strings are ByteArrays storing Characters.
   139 
   139 
   140     Strings are kind of kludgy: to allow for easy handling by C functions,
   140     Strings are kind of kludgy: to allow for easy handling by C functions,
   141     there is always one 0-byte added at the end, which is not counted
   141     there is always one 0-byte added at the end, which is not counted
   142     in the strings size, and is not accessible from the smalltalk level.
   142     in the string's size, and is not accessible from the Smalltalk level.
   143     This guarantees, that a smalltalk string can always be passed to a
   143     This guarantees, that a Smalltalk string can always be passed to a
   144     C- or a system api function without danger (of course, this does not
   144     C- or a system api function without danger 
   145     prevent a nonsense contents ...)
   145     (of course, this does not prevent a nonsense contents...)
   146 
   146 
   147     You cannot add any instvars to String, since the run time system & compiler
   147     You cannot add any instvars to String, since the run time system & compiler
   148     creates literal strings and knows that strings have no named instvars.
   148     creates literal strings and knows that strings have no named instvars.
   149     If you really need strings with instVars, you have to create a subclass
   149     If you really need strings with instVars, you have to create a subclass
   150     of String (the access functions defined here can handle this).
   150     of String (the access functions defined here can handle this).
   151     A little warning though: not all smalltalk systems allow subclassing String,
   151     A little warning though: not all Smalltalk systems allow subclassing String,
   152     so your program may become unportable if you do so.
   152     so your program may become unportable if you do so.
   153 
   153 
   154     Strings have an implicit (assumed) encoding of ISO-8859-1.
   154     Strings have an implicit (assumed) encoding of ISO-8859-1.
   155     For strings with other encodings, either keep the encoding separately,
   155     For strings with other encodings, either keep the encoding separately,
   156     or use instances of encodedString.
   156     or use instances of encodedString.
   159     the implementations of some String methods use C functions and may
   159     the implementations of some String methods use C functions and may
   160     therefore yield unexpected results (e.g. compareWith:collating:) when
   160     therefore yield unexpected results (e.g. compareWith:collating:) when
   161     processing a String containing the 0-byte.
   161     processing a String containing the 0-byte.
   162 
   162 
   163     [author:]
   163     [author:]
   164 	Claus Gittinger
   164         Claus Gittinger
   165 
   165 
   166     [see also:]
   166     [see also:]
   167 	Text StringCollection TwoByteString JISEncodedString
   167         Text StringCollection TwoByteString JISEncodedString
   168 	Symbol
   168         Symbol
   169 "
   169 "
   170 ! !
   170 ! !
   171 
   171 
   172 !String class methodsFor:'instance creation'!
   172 !String class methodsFor:'instance creation'!
   173 
   173 
   524     ].
   524     ].
   525     ^ TAB
   525     ^ TAB
   526 ! !
   526 ! !
   527 
   527 
   528 
   528 
       
   529 
       
   530 
   529 !String class methodsFor:'queries'!
   531 !String class methodsFor:'queries'!
   530 
   532 
   531 defaultPlatformClass
   533 defaultPlatformClass
   532     "dummy for ST-80 compatibility"
   534     "dummy for ST-80 compatibility"
   533 
   535 
   542 
   544 
   543     ^ self == String
   545     ^ self == String
   544 
   546 
   545     "Modified: 23.4.1996 / 16:00:38 / cg"
   547     "Modified: 23.4.1996 / 16:00:38 / cg"
   546 ! !
   548 ! !
       
   549 
       
   550 
       
   551 
       
   552 
   547 
   553 
   548 
   554 
   549 !String methodsFor:'accessing'!
   555 !String methodsFor:'accessing'!
   550 
   556 
   551 at:index
   557 at:index
  5101 
  5107 
  5102     "Created: / 01-05-2017 / 12:50:18 / cg"
  5108     "Created: / 01-05-2017 / 12:50:18 / cg"
  5103     "Modified (comment): / 01-05-2017 / 14:05:41 / cg"
  5109     "Modified (comment): / 01-05-2017 / 14:05:41 / cg"
  5104 ! !
  5110 ! !
  5105 
  5111 
       
  5112 
  5106 !String methodsFor:'substring searching'!
  5113 !String methodsFor:'substring searching'!
  5107 
  5114 
  5108 caseInsensitiveIndexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue
  5115 caseInsensitiveIndexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue
  5109     "naive search fallback (non-BM).
  5116     "naive search fallback (non-BM).
  5110      Private method to speed up caseInSensitive searches"
  5117      Private method to speed up caseInSensitive searches"
  5406     ^ aRequestor traceString:self level:level from:referrer
  5413     ^ aRequestor traceString:self level:level from:referrer
  5407 
  5414 
  5408 
  5415 
  5409 ! !
  5416 ! !
  5410 
  5417 
       
  5418 
  5411 !String class methodsFor:'documentation'!
  5419 !String class methodsFor:'documentation'!
  5412 
  5420 
  5413 version
  5421 version
  5414     ^ '$Header$'
  5422     ^ '$Header$'
  5415 !
  5423 !