Javascript String IsNullOrEmpty(value)

Description

Javascript String IsNullOrEmpty(value)




String.IsNullOrEmpty = function (value) {
    if (value) {/*from w  ww  . jav  a 2  s.  c  o  m*/
        if (typeof (value) == 'string') {
            if (value.length > 0)
                return false;
        }
        if (value != null)
            return false;
    }
    return true;
}

Javascript String isNullOrEmpty(value)

String.isNullOrEmpty = function (value) {
 return !value || value === "";
};

Javascript String IsNullOrEmpty(value)

//Returns QueryString from URL
function getQueryStrings() {
    var assoc = {};
    var decode = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); };
    var queryString = location.search.substring(1);
    var keyValues = queryString.split('&');

    for (var i in keyValues) {
        var key = keyValues[i].split('=');
        if (key.length > 1) {
            assoc[decode(key[0])] = decode(key[1]);
        }/* w ww  .java2  s .c  o m*/
    }
    return assoc;
}

String.prototype.IsNullOrEmpty = function (value) {
    if (value == null || value == "" || value == undefined)
        return false;
    else
        return true;
}



PreviousNext

Related