Javascript String startWith(s)

Description

Javascript String startWith(s)


String.prototype.startWith = function (s) {
    return this.indexOf(s) == 0
}

Javascript String startWith(s)

String.prototype.startWith = function(s) {
  if (s == null || s == "" || this.length == 0 || s.length > this.length)
    return false;
  if (this.substr(0, s.length) == s)
    return true;//from ww w .  j av a2s  .co m
  else
    return false;
  return true;
}



PreviousNext

Related