Node.js examples for String:sub string
String truncate Middle
String.prototype.truncateMiddle = function j(p, o) { if (p >= this.length) { return this }// w w w . jav a2s .c om if (o === undefined) { o = "..." } var q = Math.floor(p) / 2; return this.substring(0, q) + o + this.substring(this.length - (p - q)) };