boost::format sprintf QString 字符串处理
来源:互联网 发布:js继承题目 编辑:程序博客网 时间:2024/06/02 07:24
boost库介绍的此函数的功能
下面是实例
/* * ===================================================================================== * * Filename: format.cpp * * Description: using namespace std; * using boost::format; * using boost::io::group; * * Version: 1.0 * Created: 2014年06月19日 14时19分55秒 * Revision: none * Compiler: gcc * * Author: 刘浪 LiuLang (), datuhao@foxmail.com * Organization: * * ===================================================================================== */#include <iostream>#include <boost/format.hpp>#include <QString>using namespace std;using boost::format;int main(void){<span style="white-space:pre"></span>string str = (format("test boost format %s, %s, \%s") % "arg1" % "arg2" % "arg3").str();<span style="white-space:pre"></span>cout<<str<<endl;<span style="white-space:pre"></span>cout << format("writing %s, x=%s : %d-th step \n") % "toto" % 40.23 % 50L; <span style="white-space:pre"></span>QString qstr = QString("SELECT hex(Block_Hash) FROM block_head where \Block_Hash=cast(0x%1 as binary)").arg(QString("headerHash.ToString().c_str()"));<span style="white-space:pre"></span>cout<<qstr.toStdString()<<endl;<span style="white-space:pre"></span>return 0;}
./src test boost format arg1, arg2, arg3writing toto, x=40.23 : 50-th step SELECT hex(Block_Hash) FROM block_head where Block_Hash=cast(0xheaderHash.ToString().c_str() as binary)
0 0
- boost::format sprintf QString 字符串处理
- boost format字符串格式化
- boost——字符串与文本处理format
- boost的字符串处理函数——format
- boost::format(字符串格式化库)
- 字符串的处理常用sprintf
- 使用Boost Format库实现sprintf和CString的Format功能
- boost 处理字符串
- boost 字符串处理
- Boost字符串处理
- boost 字符串处理
- boost::algorithm 字符串处理
- boost 字符串处理(1)
- boost 字符串处理(2)
- boost——format格式化字符串
- 用boost::format来格式化字符串
- php中的sprintf()函数的format格式字符串
- QString & QString::sprintf(const char * cformat, ...)应用
- 黑马程序员--.NET笔记--枚举、数组、排序、方法、变量的作用域、重载
- IllegalStateException: Can not perform this action after onSaveInstanceState解决办法
- web.xml
- 48_leetcode_Next Permutation
- xml的开发及文件表
- boost::format sprintf QString 字符串处理
- TextFx-Ease Function(缓动函数)
- MYSQL字段,表名大小写的问题 CASE IN-SENSITIVE MYSQL ON LINUX
- 账务账号的修改
- daemon 的命名守则
- header('Content-Type:text/xml'); 使用header函数时候的注意事项
- 计算机学习
- 走过小木桥——创业者的哲理小故事
- 关于结构体的对齐方式