boost split字符串
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字符串的更多相关文章
- boost::algorithm(字符串算法库)
没什么说的,需要 #include<boost/algorithm/string.hpp> 1.大小写转换 std::string s("test string"); ...
- Boost::split用法详解
工程中使用boost库:(设定vs2010环境)在Library files加上 D:\boost\boost_1_46_0\bin\vc10\lib在Include files加上 D:\boost ...
- Split字符串分割函数
非常非常常用的一个函数Split字符串分割函数. Dim myTest myTest = "aaa/bbb/ccc/ddd/eee/fff/ggg" Dim arrTest arr ...
- freemarker中的split字符串分割
freemarker中的split字符串分割 1.简易说明 split分割:用来根据另外一个字符串的出现将原字符串分割成字符串序列 2.举例说明 <#--freemarker中的split字符串 ...
- freemarker中的split字符串分割(十六)
1.简易说明 split分割:用来根据另外一个字符串的出现将原字符串分割成字符串序列 2.举例说明 <#--freemarker中的split字符串分割--> <#list &quo ...
- C++开发--在Visual Studio2013中使用boost::split()编译过程中出现error C4996
Visual Studio is being overly cautious. In debug mode, visual studio uses something called "Ch ...
- freemarker中间split字符串切割
freemarker中间split字符串切割 1.简易说明 split切割:用来依据另外一个字符串的出现将原字符串切割成字符串序列 2.举例说明 <#--freemarker中的split字符串 ...
- c++分割字符串(类似于boost::split)
由于c++字符串没有split函数,所以字符串分割单词的时候必须自己手写,也相当于自己实现一个split函数吧! 如果需要根据单一字符分割单词,直接用getline读取就好了,很简单 #include ...
- hive函数 -- split 字符串分割函数
hive字符串分割函数 split(str, regex) - Splits str around occurances that match regexTime taken: 0.769 secon ...
随机推荐
- 学习记录:交叉编译环境配置(buildroot and gdb&gdbserver)【转】
本文转载自:https://blog.csdn.net/zhy025907/article/details/52332528 1,背景 因为参加公司的路由器逆向培训,首先需要的就是环境的配置准备工作, ...
- SaltStack本地管理无master模式-第八篇
Salt本地管理应用场景 1.在边缘节点服务器非常少没有Salt-master 2.零售店,电影院等弱网络环境没有Salt-master 3.快速部署单个服务没有Salt-master 实现 一,安装 ...
- PHP设计模式(六): 单例模式
- Secure a Web API with Individual Accounts and Local Login in ASP.NET Web API 2.2
https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/individual-accounts-in-web-api Ind ...
- javascript的日常代码
1. 直接输出文字: document.write("<显示的类型>显示文字</类型>"); <script>document.writ ...
- Objective C Protocol implementation
protocol 类似于接口,可以实现函数的回调 @protocol MyDelegate<NSObject> -(void)myCallbackFunction; @end //Call ...
- logback MDC 使用
有时候想在logback日志中打印请求IP.流水号这些信息,可以通过MDC(Mapped Diagnostic Contexts)实现: MDC.put("requestNo", ...
- Sql索引
1.为什么要给表加上主键?建表的时候都会为表加上主键, 在某些关系数据库中, 如果建表时不指定主键,数据库会拒绝建表的语句执行. 一个没加主键的表,并不能被称之为「表」.一个没加主键的表,它的数据无序 ...
- 搭建selenium + Python环境的总结:
安装Python+Selenium 写博客是一个不错的选择,首先,是担心自己忘掉,其次,可以供大家做一个参考: 其实,这是自己第一次搭建Python环境(之前用了一周的Idle),还是比较容易的吧: ...
- 初学Laravel框架与ThinkPHP框架的不同
作为一个PHP菜鸟初学Laravel框架 在学习过程中我发现了其与TP框架的不同点,由于时间问题和认识还不够完善我先写出其中几点,有错误的地方希望各位大牛斧正... 1.渲染模版方式的不同:在Lara ...