web/data/cubicweb.python.js
branchstable
changeset 6921 c1fdf590712f
parent 6880 4be32427b2b9
--- a/web/data/cubicweb.python.js	Fri Jan 28 16:19:22 2011 +0100
+++ b/web/data/cubicweb.python.js	Fri Jan 28 23:11:28 2011 +0100
@@ -188,6 +188,16 @@
     return this.replace(/^\s*(.*?)\s*$/, "$1");
 };
 
+/**
+ * .. function:: String.prototype.rstrip()
+ *
+ * python-like rstrip method for js strings
+ */
+String.prototype.rstrip = function(str) {
+    if (!str) { str = '\s' ; }
+    return this.replace(new RegExp('^(.*?)' + str + '*$'), "$1");
+};
+
 // ========= class factories ========= //
 
 /**