Javascript String isEmpty()
function isEmpty(str) { return (!str || 0 === str.length); } function isBlank(str) { return (!str || /^\s*$/.test(str)); } String.prototype.isEmpty = function() { return (this.length === 0 || !this.trim()); };
String.prototype.isEmpty = function() { return this == ''; };
// Check for an empty string. String.prototype.isEmpty = function() { return this.length === 0 || !this.trim(); };
String.prototype.isEmpty = function() { return this == null || this == ''; }; RegExp.escape = function(val) { return val.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); };
String.prototype.isEmpty = function() { return (this.length === 0 || !this.trim()); };
String.prototype.isEmpty = function() { return this.toString().trim() == ""; };
String.prototype.isEmpty = function() { return (this == ''); }; String.prototype.contains = function(it) { if (it instanceof Array) { for (var i in it) { if (this.indexOf(it[i]) != -1) return true; //ww w.j a v a2 s .c o m } return false; } else return this.indexOf(it) != -1; };
String.prototype.isEmpty = function() { return (!this || 0 === this.length); };
String.prototype.isEmpty = function () { return this.Trim().length == 0; };
// Where to put utility? String.prototype.isEmpty = function() { return (this.length === 0 || !this.trim()); } Array.prototype.appendStringToElementAtIndex = function(index, str) { if(typeof this[index] === 'undefined' || typeof this[index] !== 'string') return false; this[index] += ' ' + str; };
String.prototype.isEmpty = function () { return (!this || this == "[object Null]" || this == "" || this == "undefined"); }
String.prototype.isEmpty = function(){ var str = this;/*from ww w .j av a2 s . co m*/ return str == ''; } String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');}; Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] == obj) { return true; } } return false; }
String.prototype.isEmpty = function() { return this.trim() === ""; }