Thousand separator in C++ -
i want create string in c++ following format:
string + numberswithformatandthousandseparator + string
i not sure whether std::string
or snprintf()
provides format thousand separator. me this?
fast , easy way:
std::ostringstream ss; ss.imbue(std::locale("en_us.utf-8")); ss << 1033224.23; return ss.str();
would return string "1,033,244.23"
but requires en_us.utf-8
locale configured on system.
Comments
Post a Comment