string operation -need a better way
<p>I have a required where i need to extract a number from a string in the needed format like :</p>

<ul>
<li>f001-->100</li>
<li>f100-->1</li>
<li>2030-->302</li>
<li>0203-->3020</li>
<li>2031-->1302</li>
</ul>

<p>so the operation above is :</p>

<ul>
<li>remove any f character if it is present</li>
<li>reverse the string</li>
<li>remove leading zeros from the string</li>
</ul>

<p>I have written a code which is working fine in c++:</p>

<pre><code>int main(int argc,char* argv[])
{

string str1(argv[argc-1]);


reverse(str1.begin(),str1.end());
str1.erase(remove(str1.begin(),str1.end(),'f'),str1.end());
str1.erase(0,str1.find_first_not_of('0',0));

cout &lt;&lt;str1&lt;&lt;endl;

return 0;

}
</code></pre>

<p>is there any better way of doing the same thing?</p>
