Javascript String insertChar(char, place)

Description

Javascript String insertChar(char, place)

String.prototype.insertChar = function(char, place) {
  if (!(this.contains("<b>")) && !(this.contains("<i>"))) {
    var halfo = this.substring(0, place - 1)
    var halft = this.substring(place - 1, this.length)
    return halfo + char + halft;
  }/*from  w ww  .  j a  va 2s  .co m*/
  else {
    return "Bot cannot jumble messages that are bold or italic.";
  }
}



PreviousNext

Related