首页 > 编程语言 > 详细

C++之字符串分割函数

时间:2015-05-04 11:22:49      阅读:224      评论:0      收藏:0      [点我收藏+]

 

//c++之字符串分割:

std::string str_buf = "hello/world";
std::vector<std::string> str_arr;
split(str_buf, "/", str_arr);

for(std::vector<std::string>::iterator it=str_arr.begin();
    it != str_arr.end(); it++){
        std::cout << "std::string is " << *it << std::endl;
    }   


//取vector的最后一个元素:
std::string tmp = str_arr[str_arr.size()-1];

 

C++之字符串分割函数

原文:http://www.cnblogs.com/chris-cp/p/4475429.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!