mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
String/trim()
This commit is contained in:
12
lib/ext/string.js
Normal file
12
lib/ext/string.js
Normal file
@@ -0,0 +1,12 @@
|
||||
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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user