flyfish
利用boost的format
头文件
复制代码
1#include <boost/format.hpp>
复制代码
1
2boost::format f = boost::format("%.2f %s %d") % 1.234 %"123" % 12; std::string s = f.str();
等同于
复制代码
1
2
3boost::format f = boost::format("%.2f %s %d"); f % 1.234 %"123" % 12; std::string s = f.str();
类似CString的格式化
复制代码
1
2
3CString t = L"123"; CString s; s.Format(L"%.2f %s %d", 1.234, t, 12);
以上这篇C++ string格式化输出方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持靠谱客。
最后
以上就是友好冥王星最近收集整理的关于C++ string格式化输出方式的全部内容,更多相关C++内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复