Tuesday, 15 February 2011

c++ - boost locale - basic usage to convert numbers? -



c++ - boost locale - basic usage to convert numbers? -

well "strange" can't seem convert numeric values strings using boost::locale (under microsoft visual studio 2010) , boost lexical cast.

int main() { boost::locale::generator gen; std::locale::global(std::locale(gen("de_de"))); std::cout << boost::lexical_cast<double>("1,253") << std::endl; homecoming 0; }

in high german locale "," sign should used decimal identifier. above should read "1.253". doesn't work (lexical_cast gives exception) - using std::locale::global(std::locale("german_germany.1252")); work - wish utilize portable scheme , not "limit" myself microsoft's naming/codepages.

how utilize boost::locale, or utilize more portable localization std::locale?

c++ visual-studio-2010 localization boost-locale

No comments:

Post a Comment