web/data/cubicweb.python.js
branchstable
changeset 6921 c1fdf590712f
parent 6880 4be32427b2b9
equal deleted inserted replaced
6920:c41336a682ed 6921:c1fdf590712f
   186  */
   186  */
   187 String.prototype.strip = function() {
   187 String.prototype.strip = function() {
   188     return this.replace(/^\s*(.*?)\s*$/, "$1");
   188     return this.replace(/^\s*(.*?)\s*$/, "$1");
   189 };
   189 };
   190 
   190 
       
   191 /**
       
   192  * .. function:: String.prototype.rstrip()
       
   193  *
       
   194  * python-like rstrip method for js strings
       
   195  */
       
   196 String.prototype.rstrip = function(str) {
       
   197     if (!str) { str = '\s' ; }
       
   198     return this.replace(new RegExp('^(.*?)' + str + '*$'), "$1");
       
   199 };
       
   200 
   191 // ========= class factories ========= //
   201 // ========= class factories ========= //
   192 
   202 
   193 /**
   203 /**
   194  * .. function:: makeUnboundMethod(meth)
   204  * .. function:: makeUnboundMethod(meth)
   195  *
   205  *