boost split string , which is very convenience

#include <string>
#include <iostream> #include <boost/format.hpp>
#include <boost/tokenizer.hpp>
#include <boost/algorithm/string.hpp> int _tmain(int argc, _TCHAR* argv[])
{
std::wcout.imbue(std::locale("chs"));
// 待分割的字符串
std::wstring strTag = _T("I Come from China"); std::vector<std::wstring> vecSegTag;
// boost::is_any_of这里相当于分割规则了
boost::split(vecSegTag, strTag,boost::is_any_of(_T(" ,,"))); for (size_t i =0;i<vecSegTag.size();i++)
{
std::wcout<<vecSegTag[i]<<std::endl;
} vecSegTag.clear();
std::wstring strTag2 = _T("我叫小明,你呢,今天天气不错");
boost::split(vecSegTag, strTag2, boost::is_any_of(_T(" ,,"))); for (size_t i =0;i<vecSegTag.size();i++)
{
std::wcout<<vecSegTag[i]<<std::endl;
}
getchar();
return 0;
}

boost split字符串的更多相关文章

  1. boost::algorithm(字符串算法库)

    没什么说的,需要 #include<boost/algorithm/string.hpp> 1.大小写转换 std::string s("test string"); ...

  2. Boost::split用法详解

    工程中使用boost库:(设定vs2010环境)在Library files加上 D:\boost\boost_1_46_0\bin\vc10\lib在Include files加上 D:\boost ...

  3. Split字符串分割函数

    非常非常常用的一个函数Split字符串分割函数. Dim myTest myTest = "aaa/bbb/ccc/ddd/eee/fff/ggg" Dim arrTest arr ...

  4. freemarker中的split字符串分割

    freemarker中的split字符串分割 1.简易说明 split分割:用来根据另外一个字符串的出现将原字符串分割成字符串序列 2.举例说明 <#--freemarker中的split字符串 ...

  5. freemarker中的split字符串分割(十六)

    1.简易说明 split分割:用来根据另外一个字符串的出现将原字符串分割成字符串序列 2.举例说明 <#--freemarker中的split字符串分割--> <#list &quo ...

  6. C++开发--在Visual Studio2013中使用boost::split()编译过程中出现error C4996

    Visual Studio is being overly cautious.  In debug mode, visual studio uses something called "Ch ...

  7. freemarker中间split字符串切割

    freemarker中间split字符串切割 1.简易说明 split切割:用来依据另外一个字符串的出现将原字符串切割成字符串序列 2.举例说明 <#--freemarker中的split字符串 ...

  8. c++分割字符串(类似于boost::split)

    由于c++字符串没有split函数,所以字符串分割单词的时候必须自己手写,也相当于自己实现一个split函数吧! 如果需要根据单一字符分割单词,直接用getline读取就好了,很简单 #include ...

  9. hive函数 -- split 字符串分割函数

    hive字符串分割函数 split(str, regex) - Splits str around occurances that match regexTime taken: 0.769 secon ...

随机推荐

  1. 爬虫之JSON

    数据提取之JSON与JsonPATH JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,它使得人们很容易的进行阅读和编写.同时也方便了机器进行解析和生成.适 ...

  2. LeetCode——Longest Repeating Character Replacement

    1. Question Given a string that consists of only uppercase English letters, you can replace any lett ...

  3. 配置spring boot 内置tomcat的accessLog日志

    #配置内置tomcat的访问日志server.tomcat.accesslog.buffered=trueserver.tomcat.accesslog.directory=/home/hygw/lo ...

  4. MySQL行锁、间隙锁、Next-Key锁

    InnoDB是一个支持行锁的存储引擎,它有三种行锁的算法: Record Lock:行锁,单个行记录上的锁. Gap Lock:间隙锁,锁定一个范围,但不包括记录本身.GAP锁的目的,是为了防止幻读. ...

  5. CTR的贝叶斯平滑

    参考论文: Click-Through Rate Estimation for Rare Events in Online Advertising 参考的博客: 1.https://jiayi797. ...

  6. keras运行gan的几个bug解决

    http://blog.csdn.net/u012317000/article/details/79211274 https://www.jianshu.com/p/5b1f7004144d

  7. Knockout结合Bootstrap创建动态UI--产品列表管理

    本篇文章结合Bootstrap创建一个比较完整的应用,对产品列表进行管理,包括产品的增加.删除.修改. 需要的引用 <script type='text/javascript' src='htt ...

  8. 第八天 1-7 实战:创建一个root无法删除的文件

    实战:创建一个root无法删除的文件 简介:Linux文件的最底层(内核级别)属性的查看与修改 命令:lsattr.chattr Linux文件除了具有基本权限rwx,及特殊权限(SUID.SGID. ...

  9. hdu 4679 Terrorist’s destroy 树的直径+dp

    题意:给你一棵树,每条边都有值W,然后问你去掉一条边,令val = w*max(两颗新树的直径),求val最小值~ 做法,先求树的直径,然后算出直径上每个点的最长枝条长度.这样对于每一条边,假如是枝条 ...

  10. 普通用户启动redis

    重庆231 Redis 服务器 redis用户启动 复制 /etc/init.d/redis 启动脚本到 /redisdata/redis3.2下面,修改内容 [root@localhost ~]# ...