zoukankan      html  css  js  c++  java
  • 函数备份:按照指定的分隔符,将字符串进行切分

    vector<string>Preprocess:: mySplit(string s,set<string> stopwords)
    {
        vector
    <string> wordCollection;
        trim(s,
    " ");

        
    int nPosBegin=0;
        
    int nPosEnd=s.find(',',nPosBegin);
        
    while(nPosEnd!=string::npos)
        {
            
    string temp=s.substr(nPosBegin,nPosEnd-nPosBegin);
            trim(temp,
    " ");
            
    if(temp!="")
            {
                wordCollection.push_back(temp);
            }


            nPosBegin
    =s.find_first_not_of(',',nPosEnd);
            
    if(nPosBegin==string::npos)
            {
                nPosEnd
    =string::npos;
            }
            
    else
            {
                nPosEnd
    =s.find(',',nPosBegin);

            }

        }
        
    if(nPosBegin!=string::npos&&nPosEnd==string::npos)//结尾缺少分割号,添加该词
        {
            
    string temp=s.substr(nPosBegin,s.size()-nPosBegin);
            trim(temp,
    " ");
            
    if(temp!="")
            {
                wordCollection.push_back(temp);
            }


        }

        
    return wordCollection;

    }
  • 相关阅读:
    实验吧因缺思汀的绕过注入解析
    python模块中requests参数stream
    土司论坛nc反弹神器使用方法
    msf web脚本反弹shell
    python 多线程
    metasploit后门维持技术
    ew做socks5代理
    双内网渗透代理之reGeorg+Proxifier
    SVN源码泄露漏洞
    Java反射的实例
  • 原文地址:https://www.cnblogs.com/finallyliuyu/p/1967671.html
Copyright © 2011-2022 走看看