title: How do I check if a C++ std::string starts with a certain string, and convert a substring to an int?
body: <p>How do I implement the following (Python pseudocode) in C++?</p>
  
  <pre><code>if argv[1].startswith('--foo='):
      foo_value = int(argv[1][len('--foo='):])
  </code></pre>
  
  <p>(For example, if <code>argv[1]</code> is <code>--foo=98</code>, then <code>foo_value</code> is <code>98</code>.)</p>
  
  <p><strong>Update:</strong> I'm hesitant to look into Boost, since I'm just looking at making a very small change to a simple little command-line tool (I'd rather not have to learn how to link in and use Boost for a minor change).</p>