title: How to substract a specifiek text from a string with the function substring
body: <p>In order to substract a timestamp from my string i am using substring( pos,#char).</p>
  
  <p>My code works partially. The problem that i have is consistency. 
  I am retrieving a string from a textfile in the format "Name Time" , 
  Example : "Don 00:12".</p>
  
  <p>this string is extracted from the file into HighScoreInfo1.
  Also from a different file i am extracting a string, which is the name part, into previous_name.</p>
  
  <p>With this information i am trying to calculate the position where the substring has to start.</p>
  
  <pre><code>int test = HighScoreInfo1.size() - (previous_name.size()+1 );
  </code></pre>
  
  <p>i already took measures for the extra char which is a space, thats the +2. 
  1 for the space and 1 to get to the position where he needs to start.</p>
  
  <p>the timestamp, 00:00, is five characters long. </p>
  
  <pre><code>                int test = HighScoreInfo1.size() - (previous_name.size()+2 );
                  TimeToBeat = HighScoreInfo1.substr(test, 5);
                  TestFile &lt;&lt; "Orginal string size " &lt;&lt; "&gt;&gt;" &lt;&lt; HighScoreInfo1.size() &lt;&lt; " " &lt;&lt; "size of name"&lt;&lt; "&gt;&gt;" &lt;&lt;previous_name.size()+2&lt;&lt;" "  &lt;&lt; "Position "&lt;&lt; test &lt;&lt; endl;
                  TestFile &lt;&lt; "Orginal string " &lt;&lt; "&gt;&gt;"&lt;&lt;HighScoreInfo1 &lt;&lt; " " &lt;&lt; "Substring"&lt;&lt; "&gt;&gt;" &lt;&lt;TimeToBeat &lt;&lt; endl;
  </code></pre>
  
  <p>this is my output with a long name:</p>
  
  <pre><code>   Orginal string size &gt;&gt;14            size of name&gt;&gt;10 Position &gt;&gt; 4
     Orginal string      &gt;&gt;Chrystel 00:09 Substring&gt;&gt;stel 
  </code></pre>
  
  <p>Sidenote: you cant see it, but with the above example the <strong>space</strong> after "stel" is the fifth character.</p>
  
  <p>This is my output with a short name:</p>
  
  <pre><code>   Orginal string size &gt;&gt;9         size of name&gt;&gt;5 Position&gt;&gt; 4
     Orginal string      &gt;&gt;Don 00:09 Substring    &gt;&gt;00:09
  </code></pre>
  
  <p>with the shorter name i get my timestamp perfectly.</p>
  
  <p>How can make this works consistent.
  I did not added the rest of my code because that part works. it is basically only the substring part that does not work consistent.</p>
  
  <p>How can i fix this?</p>