home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 232_01 / string.st < prev    next >
Text File  |  1987-06-17  |  2KB  |  84 lines

  1. Class String :ArrayedCollection
  2. [
  3.     , aString
  4.         ^ <StringCatenation self
  5.             (<SameTypeOfObject self aString>
  6.                 ifTrue:  [aString]
  7.                 ifFalse: [aString printString])>
  8. |
  9.     = aString
  10.         ^ <SameTypeOfObject self aString>
  11.             ifTrue:  [<StringCompare self aString> = 0]
  12.             ifFalse: [self compareError]
  13. |
  14.     < aString
  15.         ^ <SameTypeOfObject self aString>
  16.             ifTrue:  [<StringCompare self aString> < 0]
  17.             ifFalse: [self compareError]
  18. |
  19.     <=  aString
  20.         ^ <SameTypeOfObject self aString>
  21.             ifTrue:  [<StringCompare self aString> <= 0]
  22.             ifFalse: [self compareError]
  23. |
  24.     >=  aString
  25.         ^ <SameTypeOfObject self aString>
  26.             ifTrue:  [<StringCompare self aString> >= 0]
  27.             ifFalse: [self compareError]
  28. |
  29.     >  aString
  30.         ^ <SameTypeOfObject self aString>
  31.             ifTrue:  [<StringCompare self aString> > 0]
  32.             ifFalse: [self compareError]
  33. |
  34.     asInteger
  35.         ^ <primitive 164 self>
  36. |
  37.     asFloat
  38.         ^ <primitive 165 self>
  39. |
  40.     asSymbol
  41.         ^ <StringAsSymbol self>
  42. |
  43.     at: aNumber
  44.         ^ <StringAt self aNumber>
  45. |
  46.     at: aNumber put: aChar
  47.         <StringAtPut self aNumber aChar>
  48. |
  49.     compareError
  50.         ^ self error: 'strings can only be compared to strings'
  51. |
  52.     copyFrom: start to: stop
  53.         ^ <CopyFromLength self start (stop - start + 1) >
  54. |
  55.     copyFrom: start length: len
  56.         ^ <CopyFromLength self start len >
  57. |
  58.     deepCopy
  59.         ^ <StringCopy self >
  60. |
  61.     new: size
  62.         ^ <NewString size>
  63. |
  64.     printAt: aPoint
  65.         <PrintAt self (aPoint x) (aPoint y)>
  66. |
  67.     printString
  68.         ^ <StringPrintString self>
  69. |
  70.     print
  71.         <PrintWithReturn self>
  72. |
  73.     printNoReturn
  74.         <PrintNoReturn self>
  75. |
  76.     size
  77.         ^ <StringLength self>
  78. |
  79.     sameAs: aString
  80.         ^ <SameTypeOfObject self aString>
  81.             ifTrue:  [<StringCompareWithoutCase self aString>]
  82.             ifFalse: [self compareError]
  83. ]
  84.