home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 018.lha / prelude / char.st < prev    next >
Text File  |  1986-10-19  |  1KB  |  69 lines

  1. Class Char :Magnitude
  2. [
  3.     == aChar
  4.         ^ <primitive 6 self aChar>
  5.             ifTrue:  [<primitive 46 self aChar>]
  6.             ifFalse: [false]
  7. |    < aChar
  8.         ^ <primitive 6 self aChar>
  9.             ifTrue:  [<primitive 42 self aChar>]
  10.             ifFalse: [self compareError]
  11. |
  12.     = aChar
  13.         ^ <primitive 6 self aChar>
  14.             ifTrue:  [<primitive 46 self aChar>]
  15.             ifFalse: [self compareError]
  16. |    > aChar
  17.         ^ <primitive 6 self aChar>
  18.             ifTrue:  [<primitive 43 self aChar>]
  19.             ifFalse: [self compareError]
  20. |
  21.     asciiValue
  22.         ^ <primitive 59 self>
  23. |
  24.     asLowercase
  25.         ^ <primitive 54 self>
  26.             ifTrue:  [<primitive 57 self>]
  27.             ifFalse: [self]
  28. |
  29.     asUppercase
  30.         ^ <primitive 53 self>
  31.             ifTrue:  [<primitive 57 self>]
  32.             ifFalse: [self]
  33. |
  34.     asString
  35.         ^ <primitive 58 self>
  36. |
  37.     compareError
  38.         ^ self error: 'char cannot be compared to non char'
  39. |
  40.     digitValue        | i |
  41.         ((i <- <primitive 50 self>) isNil)
  42.             ifTrue: [self error: 'digitValue on nondigit char'].
  43.         ^ i
  44. |
  45.     isAlphaNumeric
  46.         ^ <primitive 56 self>
  47. |
  48.     isDigit
  49.         ^ self between: $0 and: $9
  50. |
  51.     isLetter
  52.         ^ self isLowercase or: [self isUppercase]
  53. |
  54.     isLowercase
  55.         ^ self between: $a and: $z 
  56. |
  57.     isSeparator
  58.         ^ <primitive 55 self>
  59. |
  60.     isUppercase
  61.         ^ (self between: $A and: $Z)
  62. |
  63.     isVowel
  64.         ^ <primitive 51 self>
  65. |
  66.     printString
  67.         ^ '$' , <primitive 58 self>
  68. ]
  69.