flyfish
利用boost的format
頭文件
#include <boost/format.hpp>
boost::format f = boost::format("%.2f %s %d") % 1.234 %"123" % 12; std::string s = f.str();等同于
boost::format f = boost::format("%.2f %s %d"); f % 1.234 %"123" % 12; std::string s = f.str();類似CString的格式化
CString t = L"123"; CString s; s.Format(L"%.2f %s %d", 1.234, t, 12);
以上這篇C++ string格式化輸出方式就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。
新聞熱點
疑難解答