Friday, July 22, 2011

Convert System::String to int in VC++

After spending nearly a hour, finally found the way to convert a numeric string of the type String^ or System::String in C++ to int:
int i = Int32:: Parse( str );
int j = Convert::ToInt32( str );
Conversion from String^ to double is similar:
double x = Double:: Parse( str );
double y = Convert::ToDouble( str );

No comments:

Post a Comment