zoukankan      html  css  js  c++  java
  • Collection

    1、字符串分割函数。比如把形如:“aa:bb:cc”这样的字符串去掉“:”分割成三部分放入str_vec中。(2016/4/19)

    //字符串分割函数
    std::vector<std::string> SplitString(std::string str_src, std::string symbol)
    {
        std::string str = str_src + symbol;    //扩展字符串尾部以方便操作
    
        std::vector<std::string> str_vec;
        while (std::string::npos != str.find(symbol))
        {
            std::string::size_type pos = str.find(symbol);
            std::string str_sub = str.substr(0, pos);
            str_vec.push_back(str_sub);
    
            str = str.substr(pos + 1, str.size() - 1);
        }
    
        return str_vec;
    }
  • 相关阅读:
    说说移动端web开发中的点击穿透问题
    将博客搬至CSDN
    IIS(4)
    IIS(2)
    IIS(3)
    IIS(1)
    链表
    常用到的关键字
    进程与线程
    文件系统的原理
  • 原文地址:https://www.cnblogs.com/dongerlei/p/5407983.html
Copyright © 2011-2022 走看看