title: Removing everything after character (and also character)
body: <p>I have a string like this:</p>
  
  <pre><code>std::string string1 = "xjdfhfakdjs%54k34k.-jk34";
  </code></pre>
  
  <p>I need to get only ""xjdfhfakdjs", but the string is dynamic, not hardcoded so I don't know what is it, the length etc. so I wanted to remove everything after %, and also the % char.</p>
  
  <p><strong>How could I do this?</strong></p>