2010-01-25 23:51:25 +01:00
|
|
|
String.prototype.trim = function() {
|
|
|
|
return this.replace(/^\s+/, '').replace(/\s+$/, '');
|
2010-06-24 22:13:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
String.prototype.startsWith = function(s) {
|
|
|
|
return this.length >= s.length && this.substring(0, s.length) == s;
|
|
|
|
};
|
|
|
|
|
|
|
|
String.prototype.endsWith = function(s) {
|
|
|
|
return this.length >= s.length && this.substring(this.length - s.length) == s;
|
|
|
|
};
|
|
|
|
|
|
|
|
String.prototype.contains = function(s) {
|
|
|
|
return this.indexOf(s) >= 0;
|
2010-04-08 21:52:23 +02:00
|
|
|
};
|