Javascript String shrink(maxLength)

Description

Javascript String shrink(maxLength)


String.prototype.shrink = function(maxLength) {
 if(isEmpty(this)) {
  return null;// www.ja  v a2 s  .  c  o m
 }
 if(this.length > maxLength) {
  return this.substring(0, maxLength);
 }
}



PreviousNext

Related