现在的位置: 首页 > 编程语言 > 正文

C++string格式化输出方式

2020年02月13日 编程语言 ⁄ 共 420字 ⁄ 字号 评论关闭

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格式化输出方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持我们。

本文标题: C++ string格式化输出方式

以上就上有关C++string格式化输出方式的全部内容,学步园全面介绍编程技术、操作系统、数据库、web前端技术等内容。

抱歉!评论已关闭.