[vtkusers] vtkstd::string from string to numers

Giancarlo Amati ilferraresebono at hotmail.it
Sat Feb 20 08:53:00 EST 2010


superb! Thanks!
GC.

Date: Sat, 20 Feb 2010 08:47:11 -0500
From: daviddoria+vtk at gmail.com
CC: vtkusers at vtk.org
Subject: Re: [vtkusers] vtkstd::string from string to numers

On Sat, Feb 20, 2010 at 8:42 AM, Giancarlo Amati <ilferraresebono at hotmail.it> wrote:






Hello Users,

is thre any functions in the std::string  which converts strings into correspondent numbers?

I mean "123.40" = double 123.40

Many thanks.
GC.
 		 	   		  

You should use string streams:

#include <sstream>
  std::string strNumber = "23.4";  std::cout << "strNumber = " << strNumber << std::endl;
  std::stringstream ss;  ss << strNumber;  double dNumber;  ss >> dNumber;  std::cout << "dNumber = " << dNumber << std::endl;

Thanks,

David 		 	   		  
_________________________________________________________________
Tutto lo spazio che ti serve, lo trovi su Hotmail
http://www.windowslive.it/hotmail/SpazioDisponibile.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100220/4cc00d3b/attachment.htm>


More information about the vtkusers mailing list