Character.st
branchjv
changeset 18011 deb0c3355881
parent 17940 985e22966acb
parent 14663 a33ac1c6c69f
child 18017 7fef9e17913f
equal deleted inserted replaced
18006:4e8f3d37bdbf 18011:deb0c3355881
   643     "
   643     "
   644 
   644 
   645     "Modified: 27.6.1996 / 12:34:51 / cg"
   645     "Modified: 27.6.1996 / 12:34:51 / cg"
   646 !
   646 !
   647 
   647 
   648 
   648 - aMagnitude
       
   649     "Return the Character that is <aMagnitude> lower than the receiver.
       
   650      Wrap if the resulting value is not a legal Character value. (JS)
       
   651      claus:
       
   652 	modified to return the difference as integer, if the argument
       
   653 	is another character. If the argument is a number, a character is
       
   654 	returned."
       
   655 
       
   656     aMagnitude isCharacter ifTrue:[
       
   657 	^ asciivalue - aMagnitude asInteger
       
   658     ].
       
   659     ^ Character codePoint:((asciivalue - aMagnitude asInteger) \\ 16r3FFFFFFF)
       
   660 
       
   661     "
       
   662      $z - $a
       
   663      $d - 3
       
   664     "
       
   665 
       
   666     "Modified: 27.6.1996 / 12:35:34 / cg"
       
   667 !
   649 
   668 
   650 // aMagnitude
   669 // aMagnitude
   651     "Return the Character who's value is the receiver divided by <aMagnitude>.
   670     "Return the Character who's value is the receiver divided by <aMagnitude>.
   652      Wrap if the resulting value is not a legal Character value. (JS)"
   671      Wrap if the resulting value is not a legal Character value. (JS)"
   653 
   672 
   658     "Return the Character who's value is the receiver modulo <aMagnitude>.
   677     "Return the Character who's value is the receiver modulo <aMagnitude>.
   659      Wrap if the resulting value is not a legal Character value. (JS)"
   678      Wrap if the resulting value is not a legal Character value. (JS)"
   660 
   679 
   661     ^ Character codePoint:(asciivalue \\ aMagnitude asInteger \\ 16r3FFFFFFF)
   680     ^ Character codePoint:(asciivalue \\ aMagnitude asInteger \\ 16r3FFFFFFF)
   662 ! !
   681 ! !
       
   682 
   663 
   683 
   664 !Character methodsFor:'comparing'!
   684 !Character methodsFor:'comparing'!
   665 
   685 
   666 < aMagnitude
   686 < aMagnitude
   667     "return true, if the arguments asciiValue is greater than the receiver's"
   687     "return true, if the arguments asciiValue is greater than the receiver's"
   732     "return true, if the argument, aCharacter is the same character,
   752     "return true, if the argument, aCharacter is the same character,
   733      ignoring case differences."
   753      ignoring case differences."
   734 
   754 
   735     self == aCharacter ifTrue:[^ true].
   755     self == aCharacter ifTrue:[^ true].
   736     ^ self asLowercase = aCharacter asLowercase
   756     ^ self asLowercase = aCharacter asLowercase
       
   757 
       
   758     "
       
   759       (Character value:345) sameAs:(Character value:345)
       
   760     "
   737 !
   761 !
   738 
   762 
   739 ~= aCharacter
   763 ~= aCharacter
   740     "return true, if the argument, aCharacter is not the same character
   764     "return true, if the argument, aCharacter is not the same character
   741      Redefined to take care of character sizes > 8bit."
   765      Redefined to take care of character sizes > 8bit."
  1370     s := WriteStream on:(String new:6).
  1394     s := WriteStream on:(String new:6).
  1371     s nextPutUtf8:self.
  1395     s nextPutUtf8:self.
  1372     ^ s contents
  1396     ^ s contents
  1373 
  1397 
  1374     "
  1398     "
  1375         '' utf8Encoded
  1399         'ä' utf8Encoded
  1376     "
  1400     "
  1377 ! !
  1401 ! !
  1378 
  1402 
  1379 !Character methodsFor:'copying'!
  1403 !Character methodsFor:'copying'!
  1380 
  1404 
  1452      'The butler did it!!' rot:13                -> 'Gur ohgyre qvq vg!!'
  1476      'The butler did it!!' rot:13                -> 'Gur ohgyre qvq vg!!'
  1453      ('The butler did it!!' rot:13) rot:13       -> 'The butler did it!!'
  1477      ('The butler did it!!' rot:13) rot:13       -> 'The butler did it!!'
  1454     "
  1478     "
  1455 ! !
  1479 ! !
  1456 
  1480 
       
  1481 
  1457 !Character methodsFor:'obsolete'!
  1482 !Character methodsFor:'obsolete'!
  1458 
  1483 
  1459 asciiValue
  1484 asciiValue
  1460     "return the asciivalue of myself.
  1485     "return the asciivalue of myself.
  1461      The name 'asciiValue' is a historic leftover:
  1486      The name 'asciiValue' is a historic leftover:
  1490     self storeOn:aGCOrStream.
  1515     self storeOn:aGCOrStream.
  1491     aGCOrStream nextPutAll:' "16r'.
  1516     aGCOrStream nextPutAll:' "16r'.
  1492     asciivalue printOn:aGCOrStream base:16.
  1517     asciivalue printOn:aGCOrStream base:16.
  1493     aGCOrStream nextPut:$".
  1518     aGCOrStream nextPut:$".
  1494 !
  1519 !
  1495 
       
  1496 
       
  1497 
  1520 
  1498 isLiteral
  1521 isLiteral
  1499     "return true, if the receiver can be used as a literal constant in ST syntax
  1522     "return true, if the receiver can be used as a literal constant in ST syntax
  1500      (i.e. can be used in constant arrays)"
  1523      (i.e. can be used in constant arrays)"
  1501 
  1524 
  2785 ! !
  2808 ! !
  2786 
  2809 
  2787 !Character class methodsFor:'documentation'!
  2810 !Character class methodsFor:'documentation'!
  2788 
  2811 
  2789 version
  2812 version
  2790     ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.143 2012/04/24 12:03:06 stefan Exp $'
  2813     ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.144 2013-01-16 14:10:58 stefan Exp $'
  2791 !
  2814 !
  2792 
  2815 
  2793 version_CVS
  2816 version_CVS
  2794     ^ '§Header: /cvs/stx/stx/libbasic/Character.st,v 1.143 2012/04/24 12:03:06 stefan Exp §'
  2817     ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.144 2013-01-16 14:10:58 stefan Exp $'
  2795 !
       
  2796 
       
  2797 version_SVN
       
  2798     ^ '$Id: Character.st 10807 2012-05-05 21:58:24Z vranyj1 $'
       
  2799 ! !
  2818 ! !
       
  2819