original_string: public static function insert($string, $substring, $index)
      {
          exception_if(!self::checkIndex($string, $index), StringOutIndexException::class);
  
          $str = '';
  
          for ($i = 0; $i < static::length($string); $i++) {
              if ($i == $index) {
                  $str .= $substring;
              }
  
              $str .= $string[$i];
          }
  
          return $str;
      }
code: public static function insert($string, $substring, $index)
      {
          exception_if(!self::checkIndex($string, $index), StringOutIndexException::class);
  
          $str = '';
  
          for ($i = 0; $i < static::length($string); $i++) {
              if ($i == $index) {
                  $str .= $substring;
              }
  
              $str .= $string[$i];
          }
  
          return $str;
      }
code_tokens: public static function insert ( $ string , $ substring , $ index ) { exception_if ( ! self :: checkIndex ( $ string , $ index ) , StringOutIndexException :: class ) ; $ str = '' ; for ( $ i = 0 ; $ i < static :: length ( $ string ) ; $ i ++ ) { if ( $ i == $ index ) { $ str .= $ substring ; } $ str .= $ string [ $ i ] ; } return $ str ; }
docstring: Insert a substring inside another string.
  
  @param string $string
  @param string $substring
  
  @return string
docstring_tokens: Insert a substring inside another string .