Click to See Complete Forum and Search --> : ToDouble() ??


Jaster
November 22nd, 2004, 03:41 AM
Hi @ll.
thisone is quite simple, but it seems not to be my day, so im asking you:


String *S = "1234.3245";
double d = S->ToDouble();


an IFormatProvider is needed as param for ToDouble, but i didnt manage to figure out, how to :(

regards.

Jinto
November 22nd, 2004, 08:52 PM
Try this.

String *s = "1234.3245";
double d = Double::Parse( s );

dumbquestion
December 16th, 2004, 07:17 PM
Usually when I convert strings to doubles in VC++ .NET, I use something like this:

String *str = S"1234.5678";
double d = System::String::Convert::ToDouble(str);

If you include "using namespace System::String;" at the top of your form, you can change the second line to just :

double d = Convert::ToDouble(str);