31 std::string src = boost::algorithm::trim_right_copy(arg);
33 size_t n = src.length(), i;
36 for (i = 0; i <
n; ++i) {
37 if (src[i] ==
'e' || src[i] ==
'E') {
47 std::complex<double> result(0., 0.);
49 result.real(boost::lexical_cast<double>(src.substr(0, i)));
51 if (i >
n-3 || (src[
n-1] !=
'j' && src[
n-1] !=
'J'))
52 boost::throw_exception(boost::bad_lexical_cast(
typeid(std::string),
typeid(std::complex<double>)));
53 double im = boost::lexical_cast<double>(src.substr(i+1,
n-i-2));
58 boost::throw_exception(boost::bad_lexical_cast(
typeid(std::string),
typeid(std::complex<double>)));