original_string: public function insert($substring, $index) {
  		if ($index <= 0) {
  			return $this->prepend($substring);
  		}
  
  		if ($index > $this->length()) {
  			return $this->append($substring);
  		}
  
  		$start = mb_substr($this->string, 0, $index, $this->encoding);
  		$end = mb_substr($this->string, $index, $this->length(), $this->encoding);
  		return new Text($start . $substring . $end);
  	}
code: public function insert($substring, $index) {
  		if ($index <= 0) {
  			return $this->prepend($substring);
  		}
  
  		if ($index > $this->length()) {
  			return $this->append($substring);
  		}
  
  		$start = mb_substr($this->string, 0, $index, $this->encoding);
  		$end = mb_substr($this->string, $index, $this->length(), $this->encoding);
  		return new Text($start . $substring . $end);
  	}
code_tokens: public function insert ( $ substring , $ index ) { if ( $ index <= 0 ) { return $ this -> prepend ( $ substring ) ; } if ( $ index > $ this -> length ( ) ) { return $ this -> append ( $ substring ) ; } $ start = mb_substr ( $ this -> string , 0 , $ index , $ this -> encoding ) ; $ end = mb_substr ( $ this -> string , $ index , $ this -> length ( ) , $ this -> encoding ) ; return new Text ( $ start . $ substring . $ end ) ; }
docstring: Inserts a substring at the given index
  
  <code>
  $str = new Text('Hello World!');<br>
  $str->insert('to this ', 5); // Hello to this World!
  </code>
  
  @param string|Text $substring
  @param int $index
  @return Text
docstring_tokens: Inserts a substring at the given index