Given a string find the first embedded occurrence of an integer
<p>This was asked in an interview:</p>

<blockquote>
  <p>Given in any string, get me the first occurence of an integer.</p>
  
  <p>For example</p>
  
  <p><strong>Str98</strong> then it should return <strong>98</strong></p>
  
  <p><strong>Str87uyuy232</strong>  -- it should return <strong>87</strong></p>
</blockquote>

<p>I gave the answer as loop through the string and compared it with numeric characters, as in </p>

<pre><code>if ((c &gt;= '0') &amp;&amp; (c &lt;= '9'))
</code></pre>

<p>Then I got the index of the number, parsed it and returned it.  Somehow he was not convinced.
Can any one share the best possible solution?</p>
