Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added JavaScript rstrip()

  • Loading branch information...
commit df1a721b70fa933bc5e693b82a83b56d17bd1dce 1 parent 461cf5a
@ironmagma authored
Showing with 45 additions and 5 deletions.
  1. +5 −4 README.md
  2. +10 −0 gentests.py
  3. +29 −0 js/src/rstrip.js
  4. +1 −1  php/build.py
View
9 README.md
@@ -12,8 +12,7 @@ the constraints of the language of implementation.
Presently, support is as follows:
-<!-- begin chart -->
-<table>
+<!-- begin chart --><table>
<caption>Supported Languages and Functions</caption>
<thead>
<tr>
@@ -22,6 +21,7 @@ Presently, support is as follows:
<th>`startswith`</th>
<th>`partition`</th>
<th>`rpartition`</th>
+ <th>`rstrip`</th>
</tr>
<tr>
<th>php</th>
@@ -29,6 +29,7 @@ Presently, support is as follows:
<td>&#10003;</td>
<td>&#10003;</td>
<td>&#10003;</td>
+ <td>&#10007;</td>
</tr>
<tr>
<th>js</th>
@@ -36,10 +37,10 @@ Presently, support is as follows:
<td>&#10003;</td>
<td>&#10003;</td>
<td>&#10003;</td>
+ <td>&#10003;</td>
</tr>
</thead>
-</table>
-<!-- end chart -->
+</table><!-- end chart -->
Contact
-------
View
10 gentests.py 100644 → 100755
@@ -70,6 +70,16 @@
["abcdefgh", "abcdefg"],
["abcdefgh", "abcdefghi"],
]
+ ],
+ [
+ "rstrip",
+ "stringfunc",
+ [
+ [" Johann went to the store today. "],
+ ["Johann went to the store today. "],
+ [" Johann went to the store today."],
+ [" Johann went to the store today. \0"]
+ ]
]
]
View
29 js/src/rstrip.js
@@ -0,0 +1,29 @@
+/*
+
+Legal boring crap follows. In simple english, you can use this
+code in your own project, be your project commercial or free.
+Just be sure to include the license and stuff. The "copyright"
+here is just for technical reasons.
+
+Copyright 2011, Philip Peterson.
+
+This file is part of Pumpkinpy.
+
+Pumpkinpy is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Pumpkinpy is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Pumpkinpy. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+String.prototype.rstrip = function () {
+ return this.replace(/\s+$/, "")
+};
View
2  php/build.py
@@ -35,7 +35,7 @@ def readfiletrim(fpath):
c = h.read()
h.close()
- c = re.sub("^<\?php\s*", "", c, flags = re.IGNORECASE)
+ c = re.sub(re.compile("^<\?php\s*", flags = re.IGNORECASE), "", c)
c = re.sub(comments, "", c)
c = c.strip()
Please sign in to comment.
Something went wrong with that request. Please try again.