• <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 閱讀(643) 評論(0)  編輯 收藏 引用 所屬分類: boost庫等
             
            久久久久无码国产精品不卡| 精产国品久久一二三产区区别| 久久久久久亚洲Av无码精品专口| 久久人妻少妇嫩草AV无码专区| 51久久夜色精品国产| 久久久久久久久久久精品尤物| 国产成人精品久久二区二区| 久久中文字幕视频、最近更新 | 香蕉久久一区二区不卡无毒影院 | 久久九九亚洲精品| 18禁黄久久久AAA片| 久久伊人精品青青草原高清| 精品国产乱码久久久久久人妻| 国产ww久久久久久久久久| 亚洲va久久久噜噜噜久久男同| 久久久久一本毛久久久| 久久99国产综合精品| 亚洲国产欧美国产综合久久| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区| 久久国产色AV免费观看| 新狼窝色AV性久久久久久| 欧美日韩精品久久免费| 久久久久亚洲AV无码专区桃色 | 97久久天天综合色天天综合色hd | 久久亚洲AV无码精品色午夜麻豆| 91久久成人免费| 亚洲综合精品香蕉久久网97 | 久久久久AV综合网成人| 国产亚洲美女精品久久久2020| 亚洲精品美女久久久久99小说| 久久久无码精品亚洲日韩软件| 久久亚洲精品无码播放| 午夜精品久久久久久影视777| 中文成人无码精品久久久不卡| 色综合久久88色综合天天 | 免费精品国产日韩热久久| 色婷婷噜噜久久国产精品12p| 要久久爱在线免费观看| 国产成人精品三上悠亚久久| 嫩草伊人久久精品少妇AV| 99精品久久精品一区二区|