title: Substring to position + exact char
body: <p>I need to get a part of a string but 'round' the cut to the next exact char ',' to avoid bad cut ; 
  Much more clear with this example :</p>
  
  <pre><code>string hand =  "AA,KK,QQ,JJ,AKs,AKo,AQs,AQo,TT,AJs,ATs,AJo,KQs,KJs,KTs,QJs,ATo,QTs,JTs,A9s,A9o,KQo,A8s,A8o,A7s,A7o,A6s,A6o,A5s,A5o,A4s,99,A4o,A3s,A2s,KJo,J9s,T9s,Q9s,QJo,KTo,Q9o,88,77,66,QTo,A3o,A2o,JTo,K9s,K8s,K7s,K6s,K5s,K4s,K3s,K2s,Q8s,Q7s,Q6s,Q5s,K9o,J8s,T8s,98s,97s,87s,86s,76s,96s,75s,65s,64s,J9o,T9o,55,54s,53s,52s,K8o,43s,32s,42s,J7s,T7s,K7o,44,33,22,Q4s,Q3s,Q2s,J6s,J5s,T6s,T5s,J4s,K6o,Q8o,J8o,T8o,98o,97o,87o,85s,K5o,K4o,K3o,K2o,95s,74s,76o,65o,54o,84s,94s,Q7o,J7o,T7o,Q6o,J3s,T4s,J2s,Q5o,T3s,T2s,Q4o,J6o,86o,T6o,96o,93s,Q3o,74o,84o,75o,64o,T2o,94o,53o,93o,63o,43o,92o,73o,83o,52o,82o,42o,62o,72o,J5o,63s,92s,73s,Q2o,J4o,83s,85o,82s,T5o,95o,J3o,62s,T4o,J2o,72s,T3o,32o";
  </code></pre>
  
  <p>The hand lenght is 662 .I want to get lets say the first 7% of the string hand :</p>
  
  <pre><code>  int startpos = 0;
    int stoppos= (662 * 7) / 100;
    string str2 = hand.substr(startpos, stoppos);
    cout &lt;&lt;  str2 &lt;&lt; endl;
  </code></pre>
  
  <p>this will output <strong>KTs,QJs,A</strong></p>
  
  <p>As you see the final hand was cut , so i 'd like to substring to the next coma to have this outputt : <strong>KTs,QJs,ATo,</strong></p>
  
  <p>i'm a c++ beginer .</p>