Browse Source

Adds String >> charCodeAt:

Nicolas Petton 11 years ago
parent
commit
42b39cb541
3 changed files with 31 additions and 0 deletions
  1. 11 0
      js/Kernel-Collections.deploy.js
  2. 16 0
      js/Kernel-Collections.js
  3. 4 0
      st/Kernel-Collections.st

+ 11 - 0
js/Kernel-Collections.deploy.js

@@ -2617,6 +2617,17 @@ return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,a
 messageSends: []}),
 smalltalk.String);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "charCodeAt:",
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ return self.charCodeAt(anInteger - 1) ;
+return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})},
+messageSends: []}),
+smalltalk.String);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "copyFrom:to:",

+ 16 - 0
js/Kernel-Collections.js

@@ -3521,6 +3521,22 @@ referencedClasses: []
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "charCodeAt:",
+category: 'accessing',
+fn: function (anInteger){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+ return self.charCodeAt(anInteger - 1) ;
+return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})},
+args: ["anInteger"],
+source: "charCodeAt: anInteger\x0a\x09< return self.charCodeAt(anInteger - 1) >",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.String);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "copyFrom:to:",

+ 4 - 0
st/Kernel-Collections.st

@@ -1105,6 +1105,10 @@ at: anIndex ifAbsent: aBlock
 	<return String(self).charAt(anIndex - 1) || aBlock()>
 !
 
+charCodeAt: anInteger
+	< return self.charCodeAt(anInteger - 1) >
+!
+
 escaped
 	<return escape(self)>
 !