• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Cpper
            C/C++高級工程師 Android高級軟件工程師 IT集成工程師 音頻工程師 熟悉c,c++,java,c#,py,js,asp等多種語言 程序猿
            本文主要涉及boost中algorithm之string問題
            基本的字符串函數類型有
            替換
            裁剪
            大小寫替換
            正則表達式
            切割
            判斷
            和擦除操作等等
            //! boost之2:字符串算法類 
            #include <string>
            #include 
            <vector>
            #include 
            <iostream>
            #include 
            <iterator>
            #include 
            <functional>
            #include 
            <boost/algorithm/string.hpp>

            using namespace std;
            using namespace boost;

            int main()
            {  
                
            //! 字符串 
                string str(" abc-*-ABC-*-aBc ");
                
                
            //! 以-或者*切割字符串 
                vector<std::string> ret;
                split(ret,str,is_any_of(
            "-*"),token_compress_on);

                
            for(unsigned int index=0;index<ret.size();index++)
                {
                    cout
            <<index<<":"<<ret[index]<<endl;
                };
                
                
            //! 切換為小寫
                to_lower(str); 
                cout
            <<"*"<<str<<"*"<<endl;
                
            //! 去掉左邊的空格
                trim_left(str);
                cout
            <<"*"<<str<<"*"<<endl;
                
            //! 去掉右邊的空格
                trim_right(str);
                cout
            <<"*"<<str<<"*"<<endl;
                
                
            //! 替換
                replace_all(str,"a","A"); 
                cout
            <<str<<endl;
                
            //! 擦除 
                cout<<erase_all_copy(str,"A")<<endl;
                
                replace_nth(str,
            "c",2,"ccsdu2004"); 
                cout
            <<str<<endl;
                
                
            //! 擦除給定范圍
                cout<<erase_range_copy(str,make_iterator_range(str.begin()+2,str.begin()+5))<<endl; 
                
                cout
            <<"is start with:A:"<<starts_with(str,string("A"))<<endl;
                cout
            <<"is end with:C:"<<ends_with(str,string("C"))<<endl;
                cout
            <<"is contain with:ccs:"<<contains(str,string("ccs"))<<endl;
                
                cout
            <<endl;
                system(
            "PAUSE");
                
            return 0;
            }


            posted on 2010-08-10 10:11 ccsdu2009 閱讀(637) 評論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            久久狠狠高潮亚洲精品| 久久久国产乱子伦精品作者| 青青热久久综合网伊人| 一本久久久久久久| 三级三级久久三级久久| 久久综合香蕉国产蜜臀AV| 精品国产综合区久久久久久 | 久久精品一本到99热免费| 成人久久精品一区二区三区| 久久久久亚洲AV无码专区网站| 国产aⅴ激情无码久久| 国产福利电影一区二区三区,免费久久久久久久精 | 麻豆成人久久精品二区三区免费| 国产成人无码久久久精品一| 久久久不卡国产精品一区二区| 久久久SS麻豆欧美国产日韩| 热久久国产精品| 久久久国产乱子伦精品作者| 精品伊人久久久| 人妻丰满?V无码久久不卡| 91精品国产高清久久久久久国产嫩草 | 国产999精品久久久久久| 亚洲国产精品无码久久| 日日狠狠久久偷偷色综合96蜜桃| 一级做a爰片久久毛片16| 久久香蕉超碰97国产精品 | 狠狠色丁香久久综合五月| 久久综合亚洲色HEZYO社区| 久久无码一区二区三区少妇| 中文字幕成人精品久久不卡| 久久久久亚洲av无码专区 | 99精品国产99久久久久久97| 亚洲国产成人精品91久久久| 大蕉久久伊人中文字幕| 麻豆精品久久久一区二区| 久久精品国产秦先生| 久久青青草原国产精品免费| 国产成人精品久久一区二区三区 | 无码人妻少妇久久中文字幕蜜桃| 7777精品伊人久久久大香线蕉| 亚洲人成无码www久久久|