Javascript String insert(index, string)
String.prototype.insert = function (index, string) { if (index > 0) return this.substring(0, index) + string + this.substring(index, this.length); else/* w w w.jav a2 s . c o m*/ return string + this; };
// Move this into another file then require it. String.prototype.insert = function (index, string) { if (index > 0) { return this.substring(0, index) + string + this.substring(index, this.length); } else {/*from w ww . j a v a 2 s .c om*/ return string + this; } };