equal
deleted
inserted
replaced
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 * |