Character.st
branchjv
changeset 18011 deb0c3355881
parent 17940 985e22966acb
parent 14663 a33ac1c6c69f
child 18017 7fef9e17913f
--- a/Character.st	Thu Dec 20 11:48:59 2012 +0000
+++ b/Character.st	Sat Jan 19 01:30:00 2013 +0000
@@ -645,7 +645,26 @@
     "Modified: 27.6.1996 / 12:34:51 / cg"
 !
 
-
+- aMagnitude
+    "Return the Character that is <aMagnitude> lower than the receiver.
+     Wrap if the resulting value is not a legal Character value. (JS)
+     claus:
+	modified to return the difference as integer, if the argument
+	is another character. If the argument is a number, a character is
+	returned."
+
+    aMagnitude isCharacter ifTrue:[
+	^ asciivalue - aMagnitude asInteger
+    ].
+    ^ Character codePoint:((asciivalue - aMagnitude asInteger) \\ 16r3FFFFFFF)
+
+    "
+     $z - $a
+     $d - 3
+    "
+
+    "Modified: 27.6.1996 / 12:35:34 / cg"
+!
 
 // aMagnitude
     "Return the Character who's value is the receiver divided by <aMagnitude>.
@@ -661,6 +680,7 @@
     ^ Character codePoint:(asciivalue \\ aMagnitude asInteger \\ 16r3FFFFFFF)
 ! !
 
+
 !Character methodsFor:'comparing'!
 
 < aMagnitude
@@ -734,6 +754,10 @@
 
     self == aCharacter ifTrue:[^ true].
     ^ self asLowercase = aCharacter asLowercase
+
+    "
+      (Character value:345) sameAs:(Character value:345)
+    "
 !
 
 ~= aCharacter
@@ -1372,7 +1396,7 @@
     ^ s contents
 
     "
-        '' utf8Encoded
+        'ä' utf8Encoded
     "
 ! !
 
@@ -1454,6 +1478,7 @@
     "
 ! !
 
+
 !Character methodsFor:'obsolete'!
 
 asciiValue
@@ -1493,8 +1518,6 @@
     aGCOrStream nextPut:$".
 !
 
-
-
 isLiteral
     "return true, if the receiver can be used as a literal constant in ST syntax
      (i.e. can be used in constant arrays)"
@@ -2787,13 +2810,10 @@
 !Character class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.143 2012/04/24 12:03:06 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.144 2013-01-16 14:10:58 stefan Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/Character.st,v 1.143 2012/04/24 12:03:06 stefan Exp §'
-!
-
-version_SVN
-    ^ '$Id: Character.st 10807 2012-05-05 21:58:24Z vranyj1 $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.144 2013-01-16 14:10:58 stefan Exp $'
 ! !
+