carto/lib/ext/string.js
2010-03-22 23:13:47 -04:00

13 lines
361 B
JavaScript

if (typeof(String.prototype.trim) === "undefined") {
String.prototype.trim = function (str) {
var str = this.replace(/^\s+/, '');
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1);
break;
}
}
return str;
};
}