<div class="gmail_quote">On Sat, Feb 20, 2010 at 8:42 AM, Giancarlo Amati <span dir="ltr"><<a href="mailto:ilferraresebono@hotmail.it">ilferraresebono@hotmail.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
Hello Users,<br><br>is thre any functions in the std::string which converts strings into correspondent numbers?<br><br>I mean "123.40" = double 123.40<br><br>Many thanks.<br>GC.<br><div class="hm">                                            </div>
</div></blockquote></div><div><br></div>You should use string streams:<br><div><br></div><div>#include <sstream></div><div><br></div><div><div> std::string strNumber = "23.4";</div><div> std::cout << "strNumber = " << strNumber << std::endl;</div>
<div> std::stringstream ss;</div><div> ss << strNumber;</div><div> double dNumber;</div><div> ss >> dNumber;</div><div> std::cout << "dNumber = " << dNumber << std::endl;</div>
<div><br></div>Thanks,<br><br>David</div>