title: Inserting string in another string at specific index c++/Qt
body: <p>I have a <code>QString</code> (it may does not matter since I convet it to std::string anyway) which contains the full unix path to a file. e.g. <code>/home/user/folder/name.of.another_file.txt</code>.</p>
  
  <p>I want to append another string to this file name right before the extension name. e.g. I pass to the function "positive", here I call it <code>vector_name</code> and at the end I want to get <code>/home/user/folder/name.of.another_file_positive.txt</code> (note that the last underscore should be added by the function itself.</p>
  
  <p>Here is my code but it does not compile, unfortunately!!</p>
  
  <pre><code>QString temp(mPath); //copy value of the member variable so it doesnt change???
  
  std::string fullPath = temp.toStdString();
  std::size_t lastIndex = std::string::find_last_of(fullPath, ".");
  std::string::insert(lastIndex, fullPath.append("_" + vector_name.toStdString()));
  
  std::cout &lt;&lt; fullPath;
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <pre><code>error: cannot call member function 'std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::size_type std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::find_last_of(const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;, std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::size_type) const [with _CharT = char; _Traits = std::char_traits&lt;char&gt;; _Alloc = std::allocator&lt;char&gt;; std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::size_type = long unsigned int]' without object
           std::size_t lastIndex = std::string::find_last_of(fullPath, ".");
  
  cannot call member function 'std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp; std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::insert(std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::size_type, const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;) [with _CharT = char; _Traits = std::char_traits&lt;char&gt;; _Alloc = std::allocator&lt;char&gt;; std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::size_type = long unsigned int]' without object
       std::string::insert(lastIndex, fullPath.append("_" + vector_name.toStdString()));
  </code></pre>
  
  <p>P.S. I would really appriciate if you also can tell me how can I achieve this using QString or Qt library itself!</p>