Javascript String fuzzy(s)

Description

Javascript String fuzzy(s)


String.prototype.fuzzy = function (s) {
    var hay = this.toLowerCase(), i = 0, n = -1, l;
    s = s.toLowerCase();/*from   w  w  w. j  a va  2s  .  c  o m*/
    for (; l = s[i++] ;) if (!~(n = hay.indexOf(l, n + 1))) return false;
    return true;
};



PreviousNext

Related