Shows how to use format xtd::parse method with floating point values (float, double and decimal).
#include <xtd/console>
#include <xtd/parse>
auto main() -> int {
std::locale::global(std::locale {"en_US.UTF-8"});
console::write_line(d1);
console::write_line(d2);
auto d3 =
xtd::parse<double>(
"1.234500e+01", number_styles::number | number_styles::allow_exponent);
console::write_line(d3);
console::write_line(d4);
console::write_line(d5);
console::write_line(d6);
try {
console::write_line(d7);
console::write_line("Exception : {}", e.message());
}
}
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.h:18
double parse< double >(const std::string &str, number_styles styles)
Convert a string into a type.
Definition parse.h:209
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10