object to string (with 15 digit precision if decimal) [modified]
-
I want to convert an object to a string and if it is a float, double, etc,,, then I would want to set the precision like I can with a printf statement. What would be an efficient way to test if a System::Object is some decimal type and then set the precision? Thanks //I've tried the following, but it does not work properly switch (System::Type::GetTypeCode(columnYValues[n]->GetType())) { case System::TypeCode::Decimal: case System::TypeCode::Double: case System::TypeCode::Single: X=System::String::Format( "{0:f15}", columnYValues[n]->ToString() ); break; default: X = columnYValues[n]->ToString(); } I am trying to create pivot tables using decimal headers and half of the time it does not work because of C++ .NET or ADO .NET's string conversions and zero tolerance.
modified on Friday, April 9, 2010 2:38 AM
-
I want to convert an object to a string and if it is a float, double, etc,,, then I would want to set the precision like I can with a printf statement. What would be an efficient way to test if a System::Object is some decimal type and then set the precision? Thanks //I've tried the following, but it does not work properly switch (System::Type::GetTypeCode(columnYValues[n]->GetType())) { case System::TypeCode::Decimal: case System::TypeCode::Double: case System::TypeCode::Single: X=System::String::Format( "{0:f15}", columnYValues[n]->ToString() ); break; default: X = columnYValues[n]->ToString(); } I am trying to create pivot tables using decimal headers and half of the time it does not work because of C++ .NET or ADO .NET's string conversions and zero tolerance.
modified on Friday, April 9, 2010 2:38 AM
try with the following: System::Convert::ToInt32 System::Convert::ToDouble System::Convert::To......